⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pi_dem_s.m

📁 FISMAT accommodates different arithmetic operators, fuzzification and defuzzification algorithm, imp
💻 M
字号:
function [ret,x0,str]=pi_dem_s(t,x,u,flag);%PI_DEM_S	is the M-file description of the SIMULINK system named PI_DEM_S.%	The block-diagram can be displayed by typing: PI_DEM_S.%%	SYS=PI_DEM_S(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 PI_DEM_S 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 PI_DEM_S with a FLAG of zero:%	[SIZES]=PI_DEM_S([],[],[],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.%	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.2)if(0 == (nargin + nargout))     set_param(sys,'Location',[118,160,618,460])     open_system(sys)end;set_param(sys,'algorithm',		'RK-45')set_param(sys,'Start time',	'0.0')set_param(sys,'Stop time',		'999999')set_param(sys,'Min step size',	'0.0001')set_param(sys,'Max step size',	'10')set_param(sys,'Relative error','1e-3')set_param(sys,'Return vars',	'')add_block('built-in/To Workspace',[sys,'/','To Workspace1'])set_param([sys,'/','To Workspace1'],...		'mat-name','t',...		'position',[420,17,470,33])add_block('built-in/Clock',[sys,'/','Clock'])set_param([sys,'/','Clock'],...		'position',[360,15,380,35])add_block('built-in/Sum',[sys,'/','Sum'])set_param([sys,'/','Sum'],...		'inputs','+-',...		'position',[105,120,125,140])add_block('built-in/Step Fcn',[sys,'/','Step Fcn'])set_param([sys,'/','Step Fcn'],...		'Time','0',...		'position',[25,115,45,135])%     Subsystem  'Graph Scope'.new_system([sys,'/','Graph Scope'])set_param([sys,'/','Graph Scope'],'Location',[0,0,274,193])add_block('built-in/S-function',[sys,'/',['Graph Scope/S-function',13,'M-file which plots',13,'lines',13,'']])set_param([sys,'/',['Graph Scope/S-function',13,'M-file which plots',13,'lines',13,'']],...		'function name','sfuny',...		'parameters','ax, color',...		'position',[130,55,180,75])add_block('built-in/Inport',[sys,'/','Graph Scope/x'])set_param([sys,'/','Graph Scope/x'],...		'position',[65,55,85,75])add_line([sys,'/','Graph Scope'],[90,65;120,65])set_param([sys,'/','Graph Scope'],...		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...		'Mask Type','Graph scope.')set_param([sys,'/','Graph Scope'],...		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*):',...		'Mask Translate','color = @4; ax = [0, @1, @2, @3];')set_param([sys,'/','Graph Scope'],...		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works.',...		'Mask Entries','10\/0\/1.5\/''y-''\/')%     Finished composite block 'Graph Scope'.set_param([sys,'/','Graph Scope'],...		'Drop Shadow',4,...		'position',[435,221,465,259])%     Subsystem  'Fuzzy controller'.new_system([sys,'/','Fuzzy controller'])set_param([sys,'/','Fuzzy controller'],'Location',[4,172,628,460])add_block('built-in/Gain',[sys,'/','Fuzzy controller/Su'])set_param([sys,'/','Fuzzy controller/Su'],...		'Gain','0.5',...		'position',[460,90,480,110])add_block('built-in/Outport',[sys,'/','Fuzzy controller/out'])set_param([sys,'/','Fuzzy controller/out'],...		'position',[530,90,550,110])add_block('built-in/Gain',[sys,'/','Fuzzy controller/Se'])set_param([sys,'/','Fuzzy controller/Se'],...		'Gain','0.8',...		'position',[170,80,190,100])add_block('built-in/S-function',[sys,'/','Fuzzy controller/Fuzzy controller'])set_param([sys,'/','Fuzzy controller/Fuzzy controller'],...		'function name','fuzzy21',...		'parameters','''pi_dem_c'',0.1',...		'position',[325,81,415,119])add_block('built-in/Inport',[sys,'/','Fuzzy controller/error'])set_param([sys,'/','Fuzzy controller/error'],...		'position',[30,80,50,100])add_block('built-in/Mux',[sys,'/','Fuzzy controller/Mux'])set_param([sys,'/','Fuzzy controller/Mux'],...		'inputs','2',...		'position',[260,80,290,115])add_block('built-in/Gain',[sys,'/','Fuzzy controller/Sd'])set_param([sys,'/','Fuzzy controller/Sd'],...		'Gain','2.8',...		'position',[200,140,220,160])add_block('built-in/Sum',[sys,'/','Fuzzy controller/Sum'])set_param([sys,'/','Fuzzy controller/Sum'],...		'inputs','+-',...		'position',[160,140,180,160])add_block('built-in/Unit Delay',[sys,'/','Fuzzy controller/Unit Delay'])set_param([sys,'/','Fuzzy controller/Unit Delay'],...		'position',[95,136,125,174])add_line([sys,'/','Fuzzy controller'],[195,90;250,90])add_line([sys,'/','Fuzzy controller'],[485,100;520,100])add_line([sys,'/','Fuzzy controller'],[295,100;315,100])add_line([sys,'/','Fuzzy controller'],[55,90;160,90])add_line([sys,'/','Fuzzy controller'],[65,90;65,155;85,155])add_line([sys,'/','Fuzzy controller'],[420,100;450,100])add_line([sys,'/','Fuzzy controller'],[130,155;150,155])add_line([sys,'/','Fuzzy controller'],[185,150;190,150])add_line([sys,'/','Fuzzy controller'],[125,90;125,125;150,145])add_line([sys,'/','Fuzzy controller'],[225,150;235,150;235,105;250,105])%     Finished composite block 'Fuzzy controller'.set_param([sys,'/','Fuzzy controller'],...		'position',[160,108,220,152])add_block('built-in/To Workspace',[sys,'/','To Workspace'])set_param([sys,'/','To Workspace'],...		'mat-name','yout',...		'position',[425,67,475,83])add_block('built-in/Mux',[sys,'/','Mux'])set_param([sys,'/','Mux'],...		'inputs','2',...		'position',[360,55,390,90])add_block('built-in/Integrator',[sys,'/','Integrator'])set_param([sys,'/','Integrator'],...		'position',[245,120,265,140])add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn'])set_param([sys,'/','Transfer Fcn'],...		'Denominator','[1 1 0]',...		'position',[300,112,335,148])add_line(sys,[130,130;150,130])add_line(sys,[50,125;95,125])add_line(sys,[385,25;410,25])add_line(sys,[340,130;380,130;380,240;75,240;75,135;95,135])add_line(sys,[380,240;425,240])add_line(sys,[395,75;415,75])add_line(sys,[340,130;340,80;350,80])add_line(sys,[225,130;235,130])add_line(sys,[270,130;290,130])add_line(sys,[270,130;270,65;350,65])% 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]=',sys,'(t,x,u,flag);'])		else			eval(['ret =', sys,'(t,x,u,flag);'])		end	else		[ret,x0,str] = feval(sys);	endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -