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

📄 penfuz_s.m

📁 FISMAT accommodates different arithmetic operators, fuzzification and defuzzification algorithm, imp
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str]=penfuz_s(t,x,u,flag);%PENFUZ_S	is the M-file description of the SIMULINK system named PENFUZ_S.%	The block-diagram can be displayed by typing: PENFUZ_S.%%	SYS=PENFUZ_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 PENFUZ_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 PENFUZ_S with a FLAG of zero:%	[SIZES]=PENFUZ_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',[0,38,624,464])     open_system(sys)end;set_param(sys,'algorithm',		'RK-45')set_param(sys,'Start time',	'0')set_param(sys,'Stop time',		'20')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/Note',[sys,'/',['Inverted pendulum on cart ',13,'(Double click on the "?" for more info)']])set_param([sys,'/',['Inverted pendulum on cart ',13,'(Double click on the "?" for more info)']],...		'position',[276,20,277,21])add_block('built-in/Sum',[sys,'/','Sum3'])set_param([sys,'/','Sum3'],...		'hide name',0,...		'position',[85,160,105,180])add_block('built-in/Constant',[sys,'/','Constant'])set_param([sys,'/','Constant'],...		'Value','-3',...		'position',[10,215,60,235])add_block('built-in/Signal Generator',[sys,'/','Signal Gen.'])set_param([sys,'/','Signal Gen.'],...		'hide name',0,...		'Peak','3.000000',...		'Peak Range','0.000000',...		'Freq','0.314000',...		'Freq Range','1.000000',...		'Wave','Sqr',...		'Units','Rads')open_system([sys,'/','Signal Gen.'])set_param([sys,'/','Signal Gen.'],...		'position',[10,148,55,182])%     Subsystem  'More Info'.new_system([sys,'/','More Info'])set_param([sys,'/','More Info'],'Location',[233,85,693,328])add_block('built-in/Note',[sys,'/',['More Info/This system simulates a cart carying an inverted pendulum',13,'and displays an animation.']])set_param([sys,'/',['More Info/This system simulates a cart carying an inverted pendulum',13,'and displays an animation.']],...		'position',[205,30,206,31])add_block('built-in/Note',[sys,'/',['More Info/The animation is created using Matlab''s Handle Graphics.',13,'The animation block is just a masked S-function.']])set_param([sys,'/',['More Info/The animation is created using Matlab''s Handle Graphics.',13,'The animation block is just a masked S-function.']],...		'position',[205,80,206,81])add_block('built-in/Note',[sys,'/',['More Info/For more information on what the S_function does,',13,'use type pendan.c, type pend0, and type pendsets.']])set_param([sys,'/',['More Info/For more information on what the S_function does,',13,'use type pendan.c, type pend0, and type pendsets.']],...		'position',[200,155,201,156])set_param([sys,'/','More Info'],...		'Mask Display','?')%     Finished composite block 'More Info'.set_param([sys,'/','More Info'],...		'hide name',0,...		'Drop Shadow',4,...		'position',[430,20,457,45])add_block('built-in/Constant',[sys,'/','Constant1'])set_param([sys,'/','Constant1'],...		'Value','0',...		'position',[80,235,100,255])add_block('built-in/Sum',[sys,'/','Sum2'])set_param([sys,'/','Sum2'],...		'hide name',0,...		'inputs','-++',...		'position',[140,152,160,188])%     Subsystem  'Fuzzy Controller1'.new_system([sys,'/','Fuzzy Controller1'])set_param([sys,'/','Fuzzy Controller1'],'Location',[4,135,628,400])add_block('built-in/Inport',[sys,'/','Fuzzy Controller1/in_12'])set_param([sys,'/','Fuzzy Controller1/in_12'],...		'Port','2',...		'position',[20,130,40,150])add_block('built-in/Note',[sys,'/','Fuzzy Controller1/x cart'])set_param([sys,'/','Fuzzy Controller1/x cart'],...		'position',[70,120,71,121])add_block('built-in/Note',[sys,'/','Fuzzy Controller1/xe=r-x'])set_param([sys,'/','Fuzzy Controller1/xe=r-x'],...		'position',[85,65,86,66])add_block('built-in/Inport',[sys,'/','Fuzzy Controller1/in_11'])set_param([sys,'/','Fuzzy Controller1/in_11'],...		'position',[20,80,40,100])add_block('built-in/Note',[sys,'/','Fuzzy Controller1/Fuzzy-Controller'])set_param([sys,'/','Fuzzy Controller1/Fuzzy-Controller'],...		'position',[391,65,392,66])add_block('built-in/S-function',[sys,'/','Fuzzy Controller1/S-function'])set_param([sys,'/','Fuzzy Controller1/S-function'],...		'function name','fuzzy21',...		'parameters','''pen_pos'',0.04',...		'position',[360,90,420,130])add_block('built-in/Outport',[sys,'/','Fuzzy Controller1/out_11'])set_param([sys,'/','Fuzzy Controller1/out_11'],...		'position',[510,100,530,120])add_block('built-in/Gain',[sys,'/','Fuzzy Controller1/Gain4'])set_param([sys,'/','Fuzzy Controller1/Gain4'],...		'Gain','0',...		'position',[445,100,465,120])add_block('built-in/Unit Delay',[sys,'/','Fuzzy Controller1/Unit Delay'])set_param([sys,'/','Fuzzy Controller1/Unit Delay'],...		'Sample time','0.04',...		'position',[70,187,120,203])add_block('built-in/Sum',[sys,'/','Fuzzy Controller1/Sum'])set_param([sys,'/','Fuzzy Controller1/Sum'],...		'inputs','+-',...		'position',[175,135,195,155])add_block('built-in/Gain',[sys,'/','Fuzzy Controller1/Gain2'])set_param([sys,'/','Fuzzy Controller1/Gain2'],...		'Gain','10',...		'position',[225,135,245,155])add_block('built-in/Gain',[sys,'/','Fuzzy Controller1/Gain'])set_param([sys,'/','Fuzzy Controller1/Gain'],...		'Gain','1/6',...		'position',[225,80,245,100])add_block('built-in/Mux',[sys,'/','Fuzzy Controller1/Mux1'])set_param([sys,'/','Fuzzy Controller1/Mux1'],...		'inputs','2',...		'position',[290,90,320,125])add_line([sys,'/','Fuzzy Controller1'],[425,110;435,110])add_line([sys,'/','Fuzzy Controller1'],[470,110;500,110])add_line([sys,'/','Fuzzy Controller1'],[325,110;350,110])add_line([sys,'/','Fuzzy Controller1'],[250,90;280,100])add_line([sys,'/','Fuzzy Controller1'],[250,145;280,115])add_line([sys,'/','Fuzzy Controller1'],[45,90;215,90])add_line([sys,'/','Fuzzy Controller1'],[45,140;165,140])add_line([sys,'/','Fuzzy Controller1'],[200,145;215,145])add_line([sys,'/','Fuzzy Controller1'],[125,195;125,150;165,150])add_line([sys,'/','Fuzzy Controller1'],[45,140;45,195;60,195])%     Finished composite block 'Fuzzy Controller1'.set_param([sys,'/','Fuzzy Controller1'],...		'position',[185,158,215,202])add_block('built-in/Sum',[sys,'/','Sum1'])set_param([sys,'/','Sum1'],...		'position',[265,168,280,217])%     Subsystem  'Fuzzy Controller2'.new_system([sys,'/','Fuzzy Controller2'])set_param([sys,'/','Fuzzy Controller2'],'Location',[4,107,628,296])add_block('built-in/Outport',[sys,'/','Fuzzy Controller2/out_21'])set_param([sys,'/','Fuzzy Controller2/out_21'],...		'position',[485,50,505,70])add_block('built-in/Gain',[sys,'/','Fuzzy Controller2/Gain4'])set_param([sys,'/','Fuzzy Controller2/Gain4'],...		'Gain','10',...		'position',[445,50,465,70])add_block('built-in/S-function',[sys,'/','Fuzzy Controller2/S-function'])set_param([sys,'/','Fuzzy Controller2/S-function'],...		'function name','fuzzy21',...		'parameters','''pen_ang'',0.04',...		'position',[360,40,420,80])add_block('built-in/Gain',[sys,'/','Fuzzy Controller2/Gain'])set_param([sys,'/','Fuzzy Controller2/Gain'],...		'Gain','1/20',...		'position',[230,30,250,50])add_block('built-in/Mux',[sys,'/','Fuzzy Controller2/Mux1'])set_param([sys,'/','Fuzzy Controller2/Mux1'],...		'inputs','2',...		'position',[300,40,330,75])add_block('built-in/Gain',[sys,'/','Fuzzy Controller2/Gain2'])set_param([sys,'/','Fuzzy Controller2/Gain2'],...		'Gain','2',...		'position',[230,85,250,105])add_block('built-in/Sum',[sys,'/','Fuzzy Controller2/Sum'])set_param([sys,'/','Fuzzy Controller2/Sum'],...		'inputs','+-',...		'position',[185,85,205,105])add_block('built-in/Unit Delay',[sys,'/','Fuzzy Controller2/Unit Delay'])set_param([sys,'/','Fuzzy Controller2/Unit Delay'],...

⌨️ 快捷键说明

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