Frequency sweap euler's model
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!