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 Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2012년 5월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by