Parameter in my ode

1 Ansicht (letzte 30 Tage)
Izak Plusko
Izak Plusko am 14 Jun. 2019
Bearbeitet: Jan am 14 Jun. 2019
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!

Antworten (1)

Jan
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);

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by