原文链接:http://tecdat.cn/?p=12307
我使用MATLAB解决以下Lorenz初始值问题:

我编写了一个函数LorenzRK4IVP(),该函数将三个微分方程组作为输入,并使用 带有步长的Runge-Kutta方法求解该系统。我使用MATLAB生成了解决方案的GIF。
% Inputs:% f1,f2,f3 = y'(t,y) as a string% y0 = initial condition% inter = interval% h = step size% call function to solve Lorenz equationsL=LorenzRK('-10*y1+10*y2','-y1*y3+28*y1-y2','y1*y2-(8/3)*y3',[0,50],[5,5,5],.01)% plot Lorenz solutionsplot3(L(:,2),L(:,3),L(:,4))% create GIF source: L=LorenzRK('-10*y1+10*y2','-y1*y3+28*y1-y2','y1*y2-(8/3)*y3',[0,50],[5,5,5],.01)
复制