where to put "." notion in x(t) equations in MATLAB

9 views (last 30 days)
I am about to plot x(t) and I wrote its function but since it requires t , it needs elements wise operators. Where do I need to put "." notion (dot notion) ? before or after t ? and does it require to re-write it all ? I don't know ehere to put "." notioan in MATLAB equations. Is there any rule fo rthat?
y3=y=(e^(zeta*(-1)*t))* ...
(((v0+(zeta+sqrt(zeta^2-1))))*e^w0*sqrt(zeta^2-1)/t*2*w0*sqrt(zeta^2-1) + ...

Accepted Answer

Fatemeh Salar
Fatemeh Salar on 9 Jul 2022
Thanks to @David Hill for puting . notion and @John D'Errico for correting exp(), Here is the answer and its working :)
y=(exp(zeta.*(-1).*t)).* ...
(((v0+(zeta+sqrt(zeta.^2-1)))).*exp(w0.*sqrt(zeta.^2-1).*t)./2.*w0.*sqrt(zeta.^2-1) + ...

More Answers (1)

David Hill
David Hill on 9 Jul 2022
%./t is only dividing by t not (t*2*w0*sqrt(zeta^2-1)), you will need () to
%divide by the whole thing. You could put '.' infront of all operators and it
%would not matter
  1 Comment
John D'Errico
John D'Errico on 9 Jul 2022
There are several misleading statements in this answer, and part of it is just flat out wrong.
  1. You CANNOT put a dot in front of all operators. This very much does matter, since there is no .+ or .- operator in MATLAB.
  2. Assuming that e and zeta are scalars, and t is a vector, then you MUST have a . in front of the ^ operator. Any such expression will fail otherwise.
  3. Assuming that e is intended as the exponential constant, this 2.71828..., then e^(stuff) is best represented as exp(stuff). This will probably be more accurate, and will also result in faster, more efficient code.

Sign in to comment.


Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by