Parameter in my ode
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi!
Im working on a physics problem that involves pendulum and i want to create resonanc graph.
I have this function
function am=f(t,y)
am=[y(2);-14.7*sin(y(1))+sin(1.9*t)]
but now i want to plot a graph of y(w/w1) where w in my case is 1.9 but i want it to make like a parameter that goes from 0 to 7 or whatever and w1 is some constant and time is also constant and has a certain value for example 1 second.
I would really appreciate some help!
0 Kommentare
Antworten (1)
Jan
am 14 Jun. 2019
Bearbeitet: Jan
am 14 Jun. 2019
and https://www.mathworks.com/help/matlab/math/parameterizing-functions.html (you find this as a link in doc ode45 also)
function am = f(t, y, w)
am = [y(2); -14.7 * sin(y(1)) + sin(1.9*t)];
end
Now call the integrator like:
w = 4;
fcn = @(t, y) f(t, y, w);
ode45(fcn, tspan, y0);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations 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!