[心得] 一些matlab小程式

看板NTUNL作者 (意志消沉的我)時間18年前 (2005/11/26 00:25), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/3 (看更多)
以下是Lorenz:(這個從書上抄下來的 :p 有現成的就懶得自己想..) 在command window裡,用ode45解題器即可: [t,x]=ode45('LorenzNew',[0,100],[0;0;1e-8]); plot(t,x); xlabel('Time(sec)'); ylabel('Output'); legend('x1','x2','x3'); figure(2); plot3(x(:,1),x(:,2),x(:,3)); xmax=max(x(:,1)); xmin=min(x(:,1)); ymax=max(x(:,2)); ymin=min(x(:,2)); zmax=max(x(:,3)); zmin=min(x(:,3)); axis([xmin xmax ymin ymax zmin zmax]); xlabel('x1') ylabel('y1') zlabel('z1') grid m file裡,可自行更改a, b,....等的參數: function dx = LorenzNew (t,x) a=3; b=1; c=10; d=10; e=1; f=30; g=1; dx = [-a*x(1)+b*x(2)*x(3); -c*x(2)+d*x(3); -e*x(1)*x(2)+f*x(2)-g*x(3)]; -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.223.94 ※ 編輯: kaiweiliou 來自: 140.112.223.94 (11/26 00:48)

11/26 09:36, , 1F
不知為什麼 matlab 畫出的圖形真的好很多....
11/26 09:36, 1F
文章代碼(AID): #13Xpi77k (NTUNL)
文章代碼(AID): #13Xpi77k (NTUNL)