function f=ffun(t,x)
f=zeros(3,1);
f(1)=-x(1)+0.5*(x(3)+x(2))*(x(3)+x(2)+sin(x(3)));
f(2)=-0.5*x(1)*(x(3)+x(2)+sin(x(3)))+sin(x(3));
f(3)=-0.5*(x(2)+x(3)+sin(x(3)));
以上是子函数
[T,Y] = ode45(@ffun,[0 10],[0.4 0.1 pi/4])
plot(T,Y)可以把数值解画成曲线.
function f=ffun(t,x)
f=zeros(3,1);
f(1)=-x(1)+0.5*(x(3)+x(2))*(x(3)+x(2)+sin(x(3)));
f(2)=-0.5*x(1)*(x(3)+x(2)+sin(x(3)))+sin(x(3));
f(3)=-0.5*(x(2)+x(3)+sin(x(3)));
以上是子函数
[T,Y] = ode45(@ffun,[0 10],[0.4 0.1 pi/4])
plot(T,Y)可以把数值解画成曲线.