about use function ode45

5 次查看(过去 30 天)
mary thoubaan
mary thoubaan 2014-12-5
回答: Mischa Kim 2014-12-5
I have written small program about ode45 my program is function z= func(t,y) z=t./y; ode45(f,[0 2],1)
and it did not run.

回答(1 个)

Mischa Kim
Mischa Kim 2014-12-5
Mary, use
function my_ode()
[T,Z] = ode45(@func,[0 2],1); % use correct name of ODE function
plot(T,Z)
end
function z = func(t,y)
z = t./y;
end
Copy-paste the code into a MATLAB function window and safe as my_ode.m.

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by