Parameter in my ode
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Jan
el 14 de Jun. de 2019
Editada: Jan
el 14 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!