Info
この質問は閉じられています。 編集または回答するには再度開いてください。
v(t) is not defined help me!
1 回表示 (過去 30 日間)
古いコメントを表示
m=70
g=10
c=10
t=0;
v(0)=0;
while t<7*log(100)
t=t+0.1
v(t+1)= v(t)+0.1*(g-((c/m)*v(t)));
end
but the error is happened
how can i change v(0)=0;
1 件のコメント
回答 (1 件)
Rik
2019 年 3 月 18 日
編集済み: Rik
2019 年 3 月 18 日
This code should work:
m=70;
g=10;
c=10;
t=0;
v=0;n=0;
while t<7*log(100)
t=t+0.1;
n=n+1;
v(n+1)= v(n)+0.1*(g-((c/m)*v(n)));
end
%OR:
m=70;
g=10;
c=10;
t=0:0.1:7*log(100);
v=zeros(size(t));
for n=2:numel(t)
v(n)=v(n-1)+0.1*(g-((c/m)*v(n-1)));
end
plot(t,v)
9 件のコメント
Walter Roberson
2019 年 3 月 18 日
Yes, but the exp() form you posted is not anywhere close to the actual solution.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!