📄 musyndm3.m
字号:
'Seed','seed',...
'position',[55,70,75,90])
add_block('built-in/Discrete Transfer Fcn',[sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2/Zero Order Hold']])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2/Zero Order Hold']],...
'Numerator','[sqrt(Cov)]',...
'Denominator','[sqrt(Ts)]',...
'Sample time','Ts',...
'position',[140,61,205,99])
add_line([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],[210,80;225,80])
add_line([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],[80,80;130,80])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'Mask Display','plot(t(:),r2(:))',...
'Mask Type','Continuous White Noise.')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'Mask Dialogue','White noise for continuous (s-domain) systems.\nBand-limited using zero-order-hold.|Noise Variance:|Sample Time:|Seed')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'Mask Translate','Cov = @1; Ts = @2; seed = @3; r = rand(1,12)-0.5; r2 = [r(1),r;r,r(12)]; t =[1:13;1:13];')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'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,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'Mask Entries','0.02\/0.1\/683421\/')
% Finished composite block ['Plant with',13,'Uncertainty/multiplicative',13,'noise 2'].
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 2']],...
'position',[45,77,85,103])
add_block('built-in/State-space',[sys,'/',['Plant with',13,'Uncertainty/pertu. weighting']])
set_param([sys,'/',['Plant with',13,'Uncertainty/pertu. weighting']],...
'A','ad',...
'B','bd',...
'C','cd',...
'D','dd',...
'Mask Display','input\nweighting.',...
'Mask Type','Performance weighting function:')
set_param([sys,'/',['Plant with',13,'Uncertainty/pertu. weighting']],...
'Mask Dialogue','Performance weighting function:\n[w1 0]\n[ 0 w2]|numerator of w1:|denominator of w1:|numerator of w2:| denominator of w2:')
set_param([sys,'/',['Plant with',13,'Uncertainty/pertu. weighting']],...
'Mask Translate','[ad,bd,cd,dd]=unpck(daug(nd2sys(@1,@2),nd2sys(@3,@4)));',...
'Mask Help','This is the weighting function of the plant model.')
set_param([sys,'/',['Plant with',13,'Uncertainty/pertu. weighting']],...
'Mask Entries','num_i1\/den_i1\/num_i2\/den_i2\/',...
'position',[120,121,195,159])
% Subsystem ['Plant with',13,'Uncertainty/multiplicative',13,'noise 1'].
new_system([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],'Location',[0,0,262,236])
add_block('built-in/Outport',[sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/out_1']])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/out_1']],...
'position',[235,70,255,90])
add_block('built-in/White Noise',[sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/White Noise']])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/White Noise']],...
'Seed','seed',...
'position',[55,70,75,90])
add_block('built-in/Discrete Transfer Fcn',[sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/Zero Order Hold']])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1/Zero Order Hold']],...
'Numerator','[sqrt(Cov)]',...
'Denominator','[sqrt(Ts)]',...
'Sample time','Ts',...
'position',[140,61,205,99])
add_line([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],[210,80;225,80])
add_line([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],[80,80;130,80])
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'Mask Display','plot(t(:),r2(:))',...
'Mask Type','Continuous White Noise.')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'Mask Dialogue','White noise for continuous (s-domain) systems.\nBand-limited using zero-order-hold.|Noise Variance:|Sample Time:|Seed')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'Mask Translate','Cov = @1; Ts = @2; seed = @3; r = rand(1,12)-0.5; r2 = [r(1),r;r,r(12)]; t =[1:13;1:13];')
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'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,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'Mask Entries','0.02\/0.1\/68932234\/')
% Finished composite block ['Plant with',13,'Uncertainty/multiplicative',13,'noise 1'].
set_param([sys,'/',['Plant with',13,'Uncertainty/multiplicative',13,'noise 1']],...
'position',[45,17,85,43])
add_block('built-in/State-space',[sys,'/',['Plant with',13,'Uncertainty/plant']])
set_param([sys,'/',['Plant with',13,'Uncertainty/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 with',13,'Uncertainty/plant']],...
'Mask Translate','a=@1; b=@2; c=@3; d=@4;',...
'Mask Help','system plant',...
'Mask Entries','a\/b\/c\/d\/',...
'position',[345,191,420,229])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[50,215;280,215])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[85,215;85,140;110,140])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[425,210;440,210])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[90,90;150,90])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[260,135;275,135;275,205;280,205])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[200,140;220,140])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[195,85;215,85;215,130;220,130])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[315,210;335,210])
add_line([sys,'/',['Plant with',13,'Uncertainty']],[90,30;125,30;125,75;150,75])
% Finished composite block ['Plant with',13,'Uncertainty'].
set_param([sys,'/',['Plant with',13,'Uncertainty']],...
'position',[365,94,395,146])
% 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 space data\n>>\n''''); mudata3; 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',[15,354,95,397])
% Subsystem ['Double click here',13,'to start loading data',13,'and mu-syn design2'].
new_system([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
'Mask Display','Re-design',...
'Mask Type','')
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
'Mask Dialogue','eval(''if ~exist(''''mu''''),fprintf(''''\nMust be licensed for RCT Toolbox\n''''), else, fprintf(''''\nCtrl_C to abort MuSyn Calculation\n\n''''); mudes3; end'')')
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click here',13,'to start loading data',13,'and mu-syn design2'].
set_param([sys,'/',['Double click here',13,'to start loading data',13,'and mu-syn design2']],...
'hide name',0,...
'position',[114,354,186,397])
% Subsystem ['Double click here',13,'to show bode plot',13,'of closed-loop3'].
new_system([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']])
set_param([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']],...
'Mask Display','Closed-Loop\nBode Plot',...
'Mask Type','')
set_param([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']],...
'Mask Dialogue','eval(''if ~exist(''''g1''''),fprintf(''''\nMust Load Data & Design First\n''''),else [x,y,z,w]=unpck(g1); [x,y,w]=bode(x,y,z,w); clg; subplot(211); loglog(w,x(:,1)); subplot(212); semilogx(w,y(:,1)); clear x y z w; end'')')
set_param([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']],...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click here',13,'to show bode plot',13,'of closed-loop3'].
set_param([sys,'/',['Double click here',13,'to show bode plot',13,'of closed-loop3']],...
'hide name',0,...
'position',[203,356,284,398])
% Subsystem ['Double click here',13,'to show zero-pole',13,'plot of closed-loop4'].
new_system([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']])
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']],...
'Mask Display','Controller\nBode Plot',...
'Mask Type','')
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']],...
'Mask Dialogue','eval(''if ~exist(''''k1''''),fprintf(''''\nMust Load Data & Design First\n''''),else [x,y,z,w]=unpck(k1); [x,y,w]=bode(x,y,z,w); clg; subplot(211); loglog(w,x(:,1)); subplot(212); semilogx(w,y(:,1)); clear x y z w; end'')')
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']],...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click here',13,'to show zero-pole',13,'plot of closed-loop4'].
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of closed-loop4']],...
'hide name',0,...
'position',[305,355,381,398])
% Subsystem ['Double click here',13,'to show bode plot ',13,'of controller'].
new_system([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']])
set_param([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']],...
'Mask Display','Closed-Loop\nZero-Pole\nLocation',...
'Mask Type','')
set_param([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']],...
'Mask Dialogue','eval(''if ~exist(''''g1''''), printf(''''Must Load Data & Desgin First''''), else, clg, [x,y,z,w]=unpck(g1); pzmap(x,y,z,w), grid; end'')')
set_param([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']],...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click here',13,'to show bode plot ',13,'of controller'].
set_param([sys,'/',['Double click here',13,'to show bode plot ',13,'of controller']],...
'hide name',0,...
'position',[404,353,488,397])
% Subsystem ['Double click here',13,'to show zero-pole',13,'plot of controller'].
new_system([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']])
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']],'Location',[2,439,106,512])
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']],...
'Mask Display','Controller\nZero-Pole\nLocation',...
'Mask Type','')
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']],...
'Mask Dialogue','eval(''if ~exist(''''k1''''), printf(''''Must Load Data & Desgin First''''), else,clg,plot(1:10), [x,y,z,w]=unpck(k1); clg, pzmap(x,y,z,w), end'')')
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']],...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click here',13,'to show zero-pole',13,'plot of controller'].
set_param([sys,'/',['Double click here',13,'to show zero-pole',13,'plot of controller']],...
'hide name',0,...
'position',[513,355,597,397])
% Subsystem ['About the musyn',13,'demo1'].
new_system([sys,'/',['About the musyn',13,'demo1']])
set_param([sys,'/',['About the musyn',13,'demo1']],'Location',[2,439,106,512])
set_param([sys,'/',['About the musyn',13,'demo1']],...
'Mask Display','?',...
'Mask Type','',...
'Mask Dialogue','eval(''clc; more(23); help mudata3; more off; fprintf(''''\n>>\n''''); '')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['About the musyn',13,'demo1'].
set_param([sys,'/',['About the musyn',13,'demo1']],...
'hide name',0,...
'position',[617,353,668,396])
add_line(sys,[610,315;645,315])
add_line(sys,[610,300;625,300;625,260;645,260])
add_line(sys,[550,310;555,310])
add_line(sys,[380,225;420,225;420,245])
add_line(sys,[290,255;320,255;320,230;335,230])
add_line(sys,[425,280;425,310;195,310;195,125;205,125])
add_line(sys,[425,310;460,310])
add_line(sys,[65,260;75,260;75,240;85,240])
add_line(sys,[500,125;540,125;540,150;630,150])
add_line(sys,[340,120;355,120])
add_line(sys,[75,60;80,60;80,100;85,100])
add_line(sys,[120,105;140,105])
add_line(sys,[120,235;130,235;130,120;140,120])
add_line(sys,[55,205;75,205;75,230;85,230])
add_line(sys,[60,130;75,130;75,110;85,110])
add_line(sys,[185,115;205,115])
add_line(sys,[240,120;250,120])
add_line(sys,[400,120;445,120])
add_line(sys,[430,120;430,245])
add_line(sys,[290,190;320,190;320,215;335,215])
add_line(sys,[500,110;635,110])
add_line(sys,[430,120;430,60;450,60])
add_line(sys,[195,115;195,45;450,45])
add_line(sys,[495,55;590,55])
% 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);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -