李亞普洛夫穩定性演示圖

automan_huyaoge發表於2020-09-24

 不穩定系統軌跡圖

                              

function d=dxdt(t,x)

d=[ x(2)+x(1)*(2-x(1)^2-x(2)^2); 
    -x(1)+x(2)*(2-x(1)^2-x(2)^2) ]; 
figure('color','w');
hold on 
for theta=[0:20]*pi/10
    x0=3*[cos(theta);sin(theta)];%定義初始值陣列
    [t,x]=ode45(@dxdt,[0:0.1:8],x0);
    plot(x(:,1),x(:,2),'linewidth',0.5)
    quiver(x(:,1),x(:,2),gradient(x(:,1)),gradient(x(:,2)),'linewidth',3.0);%增加軌跡方向箭頭
end
for theta=[0:2:20]*pi/10
    x0=1e-5*[cos(theta);sin(theta)]; [t,x]=ode45(@dxdt,[0:0.2:20],x0);
    plot(x(:,1),x(:,2),'linewidth',0.5)
    quiver(x(:,1),x(:,2),gradient(x(:,1)),gradient(x(:,2)),'linewidth',1.5)
    xlabel('x1','FontSize',18,'FontWeight','bold','Color','r');
    ylabel('x2','FontSize',18,'FontWeight','bold','Color','r')

end

 參考:

https://zhuanlan.zhihu.com/p/58738073

 

相關文章