首先,说明ode45的格式。
[t,y]=ode45(odefun,tspan,y0 ) [t,y]=ode45 ) odefun,tspan,y0,options ] [ t,y,te,ye,ie]=ode45
[自变量、因变量]=ode45 (方程式、范围、初始值);
提心吊胆:
首先,创建func2.m函数存储表达式
functionbiubiu=func2(h,t ) g=9.8; biubiu=(10000*pi/sqrt )2*g ) ) h.^(3/2)-2 * (h.^ )1/2) ); 结束
然后在MATLAB命令窗口中键入以下内容:
tspan=[1 0]; %函数范围t_1=0; %初始值[h,t]=ode45(@func2,hspan,t_1); plot(h,t ); %图
可以丰富图像,增加横坐标名称、纵坐标名称和标题
xlabel(h值) (ylabel ) y值) (title ) (一阶微分方程) )。
3358 www.Sina.com/: https://WW2.mathworks.cn/help/MATLAB/ref/ode 45.html? s_tid=doc_ta
转载于:https://www.cn blogs.com/mayfly-nymph/p/10598998.html