Parameter in my ode

1 回表示 (過去 30 日間)
Izak Plusko
Izak Plusko 2019 年 6 月 14 日
編集済み: Jan 2019 年 6 月 14 日
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!

回答 (1 件)

Jan
Jan 2019 年 6 月 14 日
編集済み: Jan 2019 年 6 月 14 日
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);

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by