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

📄 exampl10.m

📁 自适应控制的一些MATLAB例子
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str,ts,xts]=exampl10(t,x,u,flag);%EXAMPL10	is the M-file description of the SIMULINK system named EXAMPL10.%	The block-diagram can be displayed by typing: EXAMPL10.%%	SYS=EXAMPL10(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 EXAMPL10 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 EXAMPL10 with a FLAG of zero:%	[SIZES]=EXAMPL10([],[],[],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',[4,58,776,655])     open_system(sys)end;set_param(sys,'algorithm',     'RK-45')set_param(sys,'Start time',    '0.0')set_param(sys,'Stop time',     '10000')set_param(sys,'Min step size', '0.01')set_param(sys,'Max step size', '10')set_param(sys,'Relative error','1e-2')set_param(sys,'Return vars',   '')set_param(sys,'AssignWideVectorLines','on');add_block('built-in/Sum',[sys,'/','Sum1'])set_param([sys,'/','Sum1'],...		'position',[125,147,150,178])%     Subsystem  'Controller'.new_system([sys,'/','Controller'])set_param([sys,'/','Controller'],'Location',[87,58,620,394])add_block('built-in/Inport',[sys,'/','Controller/theta'])set_param([sys,'/','Controller/theta'],...		'position',[15,37,40,63])add_block('built-in/Inport',[sys,'/','Controller/omega'])set_param([sys,'/','Controller/omega'],...		'Port','2',...		'position',[15,111,40,139])add_block('built-in/Demux',[sys,'/','Controller/Demux1'])set_param([sys,'/','Controller/Demux1'],...		'outputs','2',...		'position',[75,106,115,139])add_block('built-in/Demux',[sys,'/','Controller/Demux'])set_param([sys,'/','Controller/Demux'],...		'outputs','2',...		'position',[75,31,115,64])add_block('built-in/Mux',[sys,'/','Controller/Mux'])set_param([sys,'/','Controller/Mux'],...		'position',[220,57,250,103])add_block('built-in/Fcn',[sys,'/','Controller/theta*omega'])set_param([sys,'/','Controller/theta*omega'],...		'Expr','u(1)*u(3)+u(2)*u(4)',...		'position',[290,67,340,93])add_block('built-in/Inport',[sys,'/','Controller/epsilon'])set_param([sys,'/','Controller/epsilon'],...		'Port','3',...		'position',[15,181,40,209])add_block('built-in/Transfer Fcn',[sys,'/','Controller/(s+1)//(tau*s)'])set_param([sys,'/','Controller/(s+1)//(tau*s)'],...		'Numerator','[1 1]',...		'Denominator','[0.5 0]',...		'position',[105,172,165,218])add_block('built-in/Gain',[sys,'/','Controller/Gain'])set_param([sys,'/','Controller/Gain'],...		'position',[225,177,260,213])add_block('built-in/Sum',[sys,'/','Controller/Sum'])set_param([sys,'/','Controller/Sum'],...		'inputs','+-',...		'position',[390,127,420,163])add_block('built-in/Outport',[sys,'/','Controller/u'])set_param([sys,'/','Controller/u'],...		'position',[490,131,515,159])add_line([sys,'/','Controller'],[255,80;285,80])add_line([sys,'/','Controller'],[45,50;70,50])add_line([sys,'/','Controller'],[45,125;70,125])add_line([sys,'/','Controller'],[120,40;195,40;195,65;215,65])add_line([sys,'/','Controller'],[120,55;185,55;185,75;215,75])add_line([sys,'/','Controller'],[120,115;185,115;185,85;215,85])add_line([sys,'/','Controller'],[120,130;195,130;195,95;215,95])add_line([sys,'/','Controller'],[45,195;100,195])add_line([sys,'/','Controller'],[170,195;220,195])add_line([sys,'/','Controller'],[345,80;365,80;365,135;385,135])add_line([sys,'/','Controller'],[265,195;365,195;365,155;385,155])add_line([sys,'/','Controller'],[425,145;485,145])set_param([sys,'/','Controller'],...		'Mask Display','Controller\n(Modified MRAC)')%     Finished composite block 'Controller'.set_param([sys,'/','Controller'],...		'orientation',2,...		'Drop Shadow',4,...		'position',[125,227,260,293])%     Subsystem  'Plant Model'.new_system([sys,'/','Plant Model'])set_param([sys,'/','Plant Model'],'Location',[131,119,495,333])add_block('built-in/Outport',[sys,'/','Plant Model/y'])set_param([sys,'/','Plant Model/y'],...		'position',[290,72,315,98])add_block('built-in/Sum',[sys,'/','Plant Model/Sum'])set_param([sys,'/','Plant Model/Sum'],...		'position',[120,67,140,103])add_block('built-in/Inport',[sys,'/','Plant Model/u+d'])set_param([sys,'/','Plant Model/u+d'],...		'position',[15,62,40,88])add_block('built-in/Integrator',[sys,'/','Plant Model/Integrator'])set_param([sys,'/','Plant Model/Integrator'],...		'position',[170,60,205,110])add_line([sys,'/','Plant Model'],[145,85;165,85])add_line([sys,'/','Plant Model'],[210,85;235,85;235,155;80,155;80,95;115,95])add_line([sys,'/','Plant Model'],[235,85;285,85])add_line([sys,'/','Plant Model'],[45,75;115,75])set_param([sys,'/','Plant Model'],...		'Mask Display','Plant')%     Finished composite block 'Plant Model'.set_param([sys,'/','Plant Model'],...		'Drop Shadow',4,...		'position',[160,138,245,192])add_block('built-in/Transfer Fcn',[sys,'/','Reference Model'])set_param([sys,'/','Reference Model'],...		'Denominator','[1 1]',...		'position',[300,15,365,65])%     Subsystem  'Adaptive Law'.new_system([sys,'/','Adaptive Law'])set_param([sys,'/','Adaptive Law'],'Location',[71,83,590,256])add_block('built-in/Inport',[sys,'/','Adaptive Law/epsilon'])set_param([sys,'/','Adaptive Law/epsilon'],...		'position',[15,27,40,53])add_block('built-in/Product',[sys,'/','Adaptive Law/Product'])set_param([sys,'/','Adaptive Law/Product'],...		'position',[80,65,105,85])add_block('built-in/Demux',[sys,'/','Adaptive Law/Demux'])set_param([sys,'/','Adaptive Law/Demux'],...		'outputs','2',...		'position',[140,56,180,89])add_block('built-in/Integrator',[sys,'/','Adaptive Law/Integrator1'])set_param([sys,'/','Adaptive Law/Integrator1'],...		'position',[330,87,360,133])add_block('built-in/Gain',[sys,'/','Adaptive Law/Gain1'])set_param([sys,'/','Adaptive Law/Gain1'],...		'Gain','-10',...		'position',[240,94,270,126])add_block('built-in/Gain',[sys,'/','Adaptive Law/Gain'])set_param([sys,'/','Adaptive Law/Gain'],...		'Gain','-10',...		'position',[240,19,275,51])add_block('built-in/Integrator',[sys,'/','Adaptive Law/Integrator'])set_param([sys,'/','Adaptive Law/Integrator'],...		'position',[330,14,360,56])add_block('built-in/Mux',[sys,'/','Adaptive Law/Mux'])set_param([sys,'/','Adaptive Law/Mux'],...		'inputs','2',...		'position',[410,56,440,89])add_block('built-in/Outport',[sys,'/','Adaptive Law/theta'])set_param([sys,'/','Adaptive Law/theta'],...		'position',[480,62,505,88])add_block('built-in/Inport',[sys,'/','Adaptive Law/omega'])

⌨️ 快捷键说明

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