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

📄 musyndm2.m

📁 本书是电子通信类的本科、研究生辅助教材
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str]=musyndm2(t,x,u,flag);
%MUSYNDM2	is the M-file description of the SIMULINK system named MUSYNDM2.
%	The block-diagram can be displayed by typing: MUSYNDM2.
%
%	SYS=MUSYNDM2(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 MUSYNDM2 to return state derivitives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling MUSYNDM2 with a FLAG of zero:
%	[SIZES]=MUSYNDM2([],[],[],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.

%	Copyright (c) 1990-94 by The MathWorks, Inc.

% 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',[24,105,678,442])
     open_system(sys)
end;
set_param(sys,'algorithm',		'Linear')
set_param(sys,'Start time',	'0.0')
set_param(sys,'Stop time',		'9999')
set_param(sys,'Min step size',	'0.05')
set_param(sys,'Max step size',	'0.1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',	'')

add_block('built-in/Sum',[sys,'/','Sum4'])
set_param([sys,'/','Sum4'],...
		'orientation',1,...
		'position',[455,205,475,225])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'position',[310,135,330,155])

add_block('built-in/Product',[sys,'/','Product'])
set_param([sys,'/','Product'],...
		'position',[255,40,280,60])

add_block('built-in/Signal Generator',[sys,'/','Signal Gen.'])
set_param([sys,'/','Signal Gen.'],...
		'Peak','2.000000',...
		'Peak Range','10.000000',...
		'Freq','1.000000',...
		'Freq Range','5.000000',...
		'Wave','Sqr',...
		'Units','Rads',...
		'position',[20,78,65,112])

add_block('built-in/Inport',[sys,'/','Inport2'])
set_param([sys,'/','Inport2'],...
		'position',[25,140,45,160])

add_block('built-in/State-space',[sys,'/','controller'])
set_param([sys,'/','controller'],...
		'A','ak',...
		'B','bk',...
		'C','ck',...
		'D','dk',...
		'Mask Display','H_infinity\nController',...
		'Mask Type','H_infty Controller',...
		'Mask Dialogue','H_infty Controller:|ak:|bk:|ck:|dk:')
set_param([sys,'/','controller'],...
		'Mask Translate','ak=@1;bk=@2;ck=@3;dk=@4;')
set_param([sys,'/','controller'],...
		'Mask Help','. Mask and unmask this block to see how it works.Usinf Mu Analysis and Synthesis Toolbox to design a H_infinity Controller. Change the parameters, see the designed system.')
set_param([sys,'/','controller'],...
		'Mask Entries','ak\/bk\/ck\/dk\/',...
		'position',[170,131,245,169])

add_block('built-in/Outport',[sys,'/','Outport'])
set_param([sys,'/','Outport'],...
		'position',[535,61,565,79])


%     Subsystem  ['Sensor',13,'Noise'].

new_system([sys,'/',['Sensor',13,'Noise']])
set_param([sys,'/',['Sensor',13,'Noise']],'Location',[0,0,262,236])

add_block('built-in/Discrete Transfer Fcn',[sys,'/',['Sensor',13,'Noise/Zero Order Hold']])
set_param([sys,'/',['Sensor',13,'Noise/Zero Order Hold']],...
		'Numerator','[sqrt(Cov)]',...
		'Denominator','[sqrt(Ts)]',...
		'Sample time','Ts',...
		'position',[140,61,205,99])

add_block('built-in/White Noise',[sys,'/',['Sensor',13,'Noise/White Noise']])
set_param([sys,'/',['Sensor',13,'Noise/White Noise']],...
		'Seed','seed',...
		'position',[55,70,75,90])

add_block('built-in/Outport',[sys,'/',['Sensor',13,'Noise/out_1']])
set_param([sys,'/',['Sensor',13,'Noise/out_1']],...
		'position',[235,70,255,90])
add_line([sys,'/',['Sensor',13,'Noise']],[80,80;130,80])
add_line([sys,'/',['Sensor',13,'Noise']],[210,80;225,80])
set_param([sys,'/',['Sensor',13,'Noise']],...
		'Mask Display','plot(1:20,rand(1,20))',...
		'Mask Type','Continuous White Noise.')
set_param([sys,'/',['Sensor',13,'Noise']],...
		'Mask Dialogue','White noise for continuous (s-domain) systems.\nBand-limited using zero-order-hold.|Noise Variance:|Sample Time:|Seed',...
		'Mask Translate','Cov = @1; Ts = @2; seed = @3;')
set_param([sys,'/',['Sensor',13,'Noise']],...
		'Mask Help','Implemented using white noise into Zero Order Hold block. For faster simulation set sample time to highest value possible but in accordance with the fastest dynamics of system.')
set_param([sys,'/',['Sensor',13,'Noise']],...
		'Mask Entries','0.01\/0.11\/23341\/')


%     Finished composite block ['Sensor',13,'Noise'].

set_param([sys,'/',['Sensor',13,'Noise']],...
		'orientation',2,...
		'position',[525,165,555,195])

add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
		'Port','2',...
		'position',[600,231,630,249])

add_block('built-in/State-space',[sys,'/','plant'])
set_param([sys,'/','plant'],...
		'A','a',...
		'B','b',...
		'C','c',...
		'D','d',...
		'Mask Display','plant\nmodel',...
		'Mask Type','plant',...
		'Mask Dialogue','state space model:|a: |b: |c: |d:')
set_param([sys,'/','plant'],...
		'Mask Translate','a=@1; b=@2; c=@3; d=@4;',...
		'Mask Help','system plant',...
		'Mask Entries','a\/b\/c\/d\/',...
		'position',[355,126,430,164])

add_block('built-in/Sum',[sys,'/','Sum2'])
set_param([sys,'/','Sum2'],...
		'inputs','-++',...
		'position',[115,132,135,168])

add_block('built-in/State-space',[sys,'/','perf. weighting'])
set_param([sys,'/','perf. weighting'],...
		'A','ap',...
		'B','bp',...
		'C','cp',...
		'D','dp',...
		'Mask Display','output\nweighting.',...
		'Mask Type','Performance weighting function')
set_param([sys,'/','perf. weighting'],...
		'Mask Dialogue','Performance weighting function:|numerator:|denominator:',...
		'Mask Translate','[ap,bp,cp,dp]=tf2ss(@1,@2);',...
		'Mask Help','This is the weighting function of the plant model.')
set_param([sys,'/','perf. weighting'],...
		'Mask Entries','num_o\/den_o\/',...
		'position',[495,221,570,259])

add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
		'Vgain','4.000000',...
		'Hgain','10.000000',...
		'Vmax','40.000000',...
		'Hmax','20.000000',...
		'Window',[577,194,936,349],...
		'position',[575,132,595,158])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'Mask Display','Re-Load\nData',...
		'Mask Type','')
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'Mask Dialogue','eval(''if ~exist(''''mu''''),fprintf(''''\nMust be licensed for MuSyn Toolbox\n''''), else, fprintf(''''\nLoading Data\nWarning: New data will overlap the original working data\n>>\n''''); mudata2; end'')')
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'Mask Translate','',...
		'Mask Help','')


%     Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design1'].

set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design1']],...
		'hide name',0,...
		'position',[10,284,84,326])


%     Subsystem  ['Double click here',13,'to start loading data',13,'and mu-syn design2'].

⌨️ 快捷键说明

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