y=dsolve('D2y-7*(1-y^2)*Dy+y=0','y(0)=1,Dy(0)=0','t')
命令窗口输出:警告: Explicit solution could not be found.
所以采用上述方法找不到解析解。
数值解:
function dx=a(t,x)
dx=zeros(2,1);
dx(1)=x(2);
dx(2)=7*(1-x(1)^2)*x(2)-x(1);
[T,Y]=ode15s('a',[0 50],[1 0])
plot(T,Y(:,1))
上半段用m文件写成函数形式并保存文件名为a.m,下半段在命令窗口输入,得到图像:
function test()
[t,y]=ode45(@func,[0,35],[1,0]);
plot(t,y);
function f=func(t,y)
f=[y(2);7*(1-y(1)^2)*y(2)-y(1)];