Point out the error

5 ビュー (過去 30 日間)
Syed Muhammad Umar
Syed Muhammad Umar 2015 年 10 月 6 日
コメント済み: Walter Roberson 2015 年 10 月 6 日
Matlab script to animate the motion of vibrating guitar
A= 2;
L= 10;
f= 50;
ta= 2;
x=0:0.1:L;
T=5 ;
t=0;
for t < T
y=(A)*(exp^(-t/ta))*(sin((2*pi*x)/L))*(cos(2*pi*f*t));
plot(x,y)
t=t+0.1;
pause(0.5)
end
  1 件のコメント
per isakson
per isakson 2015 年 10 月 6 日
編集済み: per isakson 2015 年 10 月 6 日
Any error messages?

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

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 6 日
"for" must be followed by a variable name and then by an "=" and then an expression. The "for" loop will then be repeated assigning the values of the expression to the variable in turn.
You probably want "while" instead of "for"
  3 件のコメント
Syed Muhammad Umar
Syed Muhammad Umar 2015 年 10 月 6 日
編集済み: Walter Roberson 2015 年 10 月 6 日
Is it Okay
A= 2;
L= 10;
f= 50;
ta= 2;
x=0:0.1:L;
t= 0;
T=5 ;
exp=2.718;
while t < T
y=(A)*(exp^(-t/ta))*(sin((2*pi*x)/L))*(cos(2*pi*f*t));
plot(x,y)
t=t+0.1;
pause(0.5)
end
Walter Roberson
Walter Roberson 2015 年 10 月 6 日
It looks plausible.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAcoustics, Noise and Vibration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by