MATLAB plotting question.

Hi, I am trying to plot out this function y(t) = A cos(xt + s(t)), where A = 1, x = 2 and s(t) = -2sin(t) over 0 to 40 sec in increments of 0.05 sec. I am using this code:
t = 0:0.05:40;
y = cos(2*t - 2sin(t));
plot(t,y)
However I keep getting an error unexpected MATLAB expression. Can anyone tell me what's wrong. I am new to this. Thanks!

 Accepted Answer

per isakson
per isakson on 28 May 2012

0 votes

"2sin(t)" should read "2*sin(t)"

2 Comments

goal24
goal24 on 28 May 2012
Oh whoops. Thanks!
Thomas
Thomas on 28 May 2012
please accept Per's answer if it solved your problem..

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects 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!