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!

 採用された回答

per isakson
per isakson 2012 年 5 月 28 日

0 投票

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

2 件のコメント

goal24
goal24 2012 年 5 月 28 日
Oh whoops. Thanks!
Thomas
Thomas 2012 年 5 月 28 日
please accept Per's answer if it solved your problem..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by