Frequency sweap euler's model
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I am trying to solve a differential equation using the euler's model:
for ii=1:length(t)-1
du = M*a(ii) + C;
u(ii+1) = u(ii) + du*dt;
end
Where u and a are vectors with the same length of the time vector (defined in my code) and dt is the timestep.
Particularly, a(ii) is defined as a sinusoidal function as following:
a = sin(w*t)
I would like to make the frequency vary so I have made a linspace vector for w:
w = linspace(0, 100, 100)
therefore, mu final code is made of 2 loops:
for j=1:lentgh(w)
for ii=1:length(t)-1
du(j) = M*a(j,ii) + C;
u(j,ii+1) = u(j,ii) + du(j)*dt;
end
end
I am obviously here because my code gives some errors. How can I fix the code? Do you have other suggestions in order to make a frequency sweap run (with differential equations involved)?
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!