求用打靶法解常微分方程的Matlab代码~谢谢!答:function ys=dbf(f,a,b,alfa,beta,h,eps)ff=@(x,y)[y(2),f(y(1),y(2),x)];xvalue=a:h:b;%x取值范围 n=length(xvalue)s0=a-0.01;%选取适当的s的初值 x0=[alfa,s0];%迭代初值 flag=0;%用于判断精度 y0=rk4(ff,a,x0,h,a,b);if abs(y0(1,n)-beta)<=eps flag=...
matlab里ode45解决二阶常系数微分方程用法答:1、相关常数都没给,这里随便设置一些数值:m=1;c=2;k=3;y0=4;yp0=5;tf=10;dy=@(t,y)[y(2);-(c*y(2)+k*y(1))/m];[t,y]=ode45(dy,[0 tf],[y0 yp0]);plot(t,y(:,1))2、function test()[t,y]=ode45(@func1, [0,1], [0;0;1;2;2;2]);figure(1);clf...