📄 rossler2.m
字号:
function [ret,x0,str,ts,xts]=rossler2(t,x,u,flag);
%ROSSLER2 is the M-file description of the SIMULINK system named ROSSLER2.
% The block-diagram can be displayed by typing: ROSSLER2.
%
% SYS=ROSSLER2(T,X,U,FLAG) returns depending on FLAG certain
% system values given time point, T, current state vector, X,
% and input vector, U.
% FLAG is used to indicate the type of output to be returned in SYS.
%
% Setting FLAG=1 causes ROSSLER2 to return state derivatives, FLAG=2
% discrete states, FLAG=3 system outputs and FLAG=4 next sample
% time. For more information and other options see SFUNC.
%
% Calling ROSSLER2 with a FLAG of zero:
% [SIZES]=ROSSLER2([],[],[],0), returns a vector, SIZES, which
% contains the sizes of the state vector and other parameters.
% SIZES(1) number of states
% SIZES(2) number of discrete states
% SIZES(3) number of outputs
% SIZES(4) number of inputs
% SIZES(5) number of roots (currently unsupported)
% SIZES(6) direct feedthrough flag
% SIZES(7) number of sample times
%
% For the definition of other parameters in SIZES, see SFUNC.
% See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.
% Note: This M-file is only used for saving graphical information;
% after the model is loaded into memory an internal model
% representation is used.
% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
set_param(sys,'Location',[171,93,615,425])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '1000')
set_param(sys,'Min step size', '0.04')
set_param(sys,'Max step size', '.04')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/Integrator',[sys,'/',[' X',13,'']])
set_param([sys,'/',[' X',13,'']],...
'ForeGround',2,...
'Initial','1',...
'position',[250,45,270,65])
add_block('built-in/Integrator',[sys,'/',' Y'])
set_param([sys,'/',' Y'],...
'ForeGround',4,...
'Initial','-4.',...
'position',[250,95,270,115])
add_block('built-in/Integrator',[sys,'/','Z'])
set_param([sys,'/','Z'],...
'ForeGround',6,...
'Initial','.5',...
'position',[250,155,270,175])
add_block('built-in/To Workspace',[sys,'/','To Workspace2'])
set_param([sys,'/','To Workspace2'],...
'mat-name','z',...
'buffer','[5000,1,.04]',...
'position',[370,157,420,173])
add_block('built-in/To Workspace',[sys,'/','To Workspace1'])
set_param([sys,'/','To Workspace1'],...
'mat-name','y',...
'buffer','[5000,1,.04]',...
'position',[370,97,420,113])
add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
'mat-name','x',...
'buffer','[5000,1,.04]',...
'position',[370,47,420,63])
add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
'inputs','--',...
'position',[140,45,160,65])
add_block('built-in/Sum',[sys,'/','Sum2'])
set_param([sys,'/','Sum2'],...
'position',[140,95,160,115])
add_block('built-in/Sum',[sys,'/','Sum1'])
set_param([sys,'/','Sum1'],...
'position',[140,155,160,175])
add_block('built-in/Product',[sys,'/','z(x-c)'])
set_param([sys,'/','z(x-c)'],...
'position',[85,165,110,185])
add_block('built-in/Sum',[sys,'/','x-c'])
set_param([sys,'/','x-c'],...
'inputs','+-',...
'position',[50,245,70,265])
add_block('built-in/Constant',[sys,'/','c'])
set_param([sys,'/','c'],...
'Value','5',...
'position',[15,285,35,305])
add_block('built-in/Constant',[sys,'/','b'])
set_param([sys,'/','b'],...
'Value','0.2',...
'position',[105,275,125,295])
add_block('built-in/Note',[sys,'/','Rossler system'])
set_param([sys,'/','Rossler system'],...
'position',[215,290,220,295])
add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
'Vgain','10.660000',...
'Hgain','200.000000',...
'Vmax','21.320000',...
'Hmax','400.000000',...
'Window',[477,394,799,598])
open_system([sys,'/','Scope'])
set_param([sys,'/','Scope'],...
'position',[360,2,380,28])
add_block('built-in/Gain',[sys,'/','a'])
set_param([sys,'/','a'],...
'Gain','0.2',...
'position',[60,84,95,126])
add_line(sys,[165,105;245,105])
add_line(sys,[165,55;245,55])
add_line(sys,[165,165;245,165])
add_line(sys,[275,165;365,165])
add_line(sys,[275,105;365,105])
add_line(sys,[275,55;365,55])
add_line(sys,[275,105;275,80;130,80;135,60])
add_line(sys,[275,165;275,215;20,215;20,50;135,50])
add_line(sys,[100,105;135,110])
add_line(sys,[275,55;275,20;100,20;100,100;135,100])
add_line(sys,[275,105;275,140;50,140;55,105])
add_line(sys,[275,55;275,65;305,65;305,235;25,235;25,250;45,250])
add_line(sys,[40,295;45,260])
add_line(sys,[75,255;90,255;90,200;45,200;45,180;80,180])
add_line(sys,[275,165;275,145;55,145;55,170;80,170])
add_line(sys,[115,175;135,160])
add_line(sys,[130,285;140,285;140,205;115,205;115,190;135,170])
add_line(sys,[330,55;330,15;355,15])
drawnow
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str,ts,xts] = feval(sys);
end
else
drawnow % Flash up the model and execute load callback
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -