M 文件和Simulink 求解连续微分系统实例分析 Matlab 自带的一个S 函数源代码: D:\MATLAB7\toolbox\simulink\blocks\sfuntmpl 例1
常微分方程(Lorenze 混沌系统): 112322331223,,,xb xx xxa xa xxx xc xx (1) 其中10,28,8/ 3arb
(1) m 文件实现:文件名为exam1
m function exam1 x0=[0;0;1e-3]; [t,x]=ode45(@lorenzfun,[0,100],x0); figure(1) plot(t,x) figure(2) plot3(x(:,1),x(:,2),x(:,3)) %---------------------------------- function dx=lorenzfun(t,x) a=10;c=28;b=8/3; dx=zeros(3,1); dx(1)=-b*x(1)+x(2)*x(3); dx(2)=-a*x(2)+10*x(3); dx(3)=-x(1)*x(2)+c*x(2)-x(3); 01 02 03 04 05 06 07 08 09 01 0 0-3 0-2 0-1 001 02 03 04 05 001 02 03 04 05 0-2 0-1 001 02 0-3 0-2 0-1 001 02 03 0 (2) (I)Simulink 模块实现:(见lorenzblok) x1-8/3x1x2x328x2x1*x2x2x23Out22x21x1ScopeProduct1Product1sIntegrator21sIntegrator11sIntegrator28Gain4-8/3Gain310Gain2-10Gain1 其中三个