Parameter in my ode
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Jan
on 14 Jun 2019
Edited: Jan
on 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 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!