📄 extrdisp.m
字号:
function [ret,x0,str,ts,xts]=extrdisp(t,x,u,flag);
%EXTRDISP is the M-file description of the SIMULINK system named EXTRDISP.
% The block-diagram can be displayed by typing: EXTRDISP.
%
% SYS=EXTRDISP(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 EXTRDISP 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 EXTRDISP with a FLAG of zero:
% [SIZES]=EXTRDISP([],[],[],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',[33,129,366,502])
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', '')
% Subsystem ['Double click',13,'on this for demo.3'].
new_system([sys,'/',['Double click',13,'on this for demo.3']])
set_param([sys,'/',['Double click',13,'on this for demo.3']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.3']],...
'Mask Display','DEMO',...
'Mask Dialogue','eval(''corrdemo'')')
% Finished composite block ['Double click',13,'on this for demo.3'].
set_param([sys,'/',['Double click',13,'on this for demo.3']],...
'hide name',0,...
'position',[137,260,191,291])
% Subsystem ['Double click',13,'on this for demo.2'].
new_system([sys,'/',['Double click',13,'on this for demo.2']])
set_param([sys,'/',['Double click',13,'on this for demo.2']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.2']],...
'Mask Display','DEMO',...
'Mask Dialogue','eval(''spectf'')')
% Finished composite block ['Double click',13,'on this for demo.2'].
set_param([sys,'/',['Double click',13,'on this for demo.2']],...
'hide name',0,...
'position',[140,167,191,196])
% Subsystem ['Double click',13,'on this for demo.1'].
new_system([sys,'/',['Double click',13,'on this for demo.1']])
set_param([sys,'/',['Double click',13,'on this for demo.1']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.1']],...
'Mask Display','DEMO',...
'Mask Dialogue','eval(''psddemo'')')
% Finished composite block ['Double click',13,'on this for demo.1'].
set_param([sys,'/',['Double click',13,'on this for demo.1']],...
'hide name',0,...
'position',[139,73,188,106])
% Subsystem 'Average PSD'.
new_system([sys,'/','Average PSD'])
set_param([sys,'/','Average PSD'],'Location',[0,0,285,136])
add_block('built-in/S-Function',[sys,'/',['Average PSD/S-function block ',13,'which calls M-file']])
set_param([sys,'/',['Average PSD/S-function block ',13,'which calls M-file']],...
'function name','sfunpsd',...
'parameters','fftpts,npts,HowOften,offset,ts,1',...
'position',[175,46,225,84])
add_block('built-in/Inport',[sys,'/','Average PSD/input signal'])
set_param([sys,'/','Average PSD/input signal'],...
'position',[65,55,85,75])
add_line([sys,'/','Average PSD'],[90,65;170,65])
set_param([sys,'/','Average PSD'],...
'Mask Display','plot(0,0,100,100,[11,92,92,11,11],[90,90,40,40,90],[82,76,65,57,51,44,35,30,25,20],[65,62,59,63,66,66,67,70,55,50])',...
'Mask Type','Spectrum analyzer.')
set_param([sys,'/','Average PSD'],...
'Mask Dialogue','Spectrum analyzer using graph window.|Length of buffer:|Number of points for fft:|Plot after how many points:|Sample time:')
set_param([sys,'/','Average PSD'],...
'Mask Translate','npts=@1; fftpts=@2; HowOften=@3; ts=@4(1); if length(@4) > 1, offset = @4(2), else, offset = 0; end')
set_param([sys,'/','Average PSD'],...
'Mask Help','This block when hooked to the output of a system displays the frequency content of the buffer in the graph window. For more see the M-file sfunpsd.',...
'Mask Entries','128\/512\/64\/0.1\/')
% Finished composite block 'Average PSD'.
set_param([sys,'/','Average PSD'],...
'Drop Shadow',4,...
'position',[240,72,270,108])
% Subsystem 'Spectrum Analyzer'.
new_system([sys,'/','Spectrum Analyzer'])
set_param([sys,'/','Spectrum Analyzer'],'Location',[0,0,371,185])
add_block('built-in/Inport',[sys,'/','Spectrum Analyzer/system input'])
set_param([sys,'/','Spectrum Analyzer/system input'],...
'position',[55,30,75,50])
add_block('built-in/S-Function',[sys,'/',['Spectrum Analyzer/S-function block',13,'which calls M-file']])
set_param([sys,'/',['Spectrum Analyzer/S-function block',13,'which calls M-file']],...
'function name','sfuntf',...
'parameters','fftpts,npts,HowOften,offset,ts,0',...
'position',[250,72,295,108])
add_block('built-in/Inport',[sys,'/','Spectrum Analyzer/system output'])
set_param([sys,'/','Spectrum Analyzer/system output'],...
'Port','2',...
'position',[55,110,75,130])
add_block('built-in/Mux',[sys,'/','Spectrum Analyzer/Mux'])
set_param([sys,'/','Spectrum Analyzer/Mux'],...
'inputs','2',...
'position',[145,71,175,104])
add_line([sys,'/','Spectrum Analyzer'],[180,90;245,90])
add_line([sys,'/','Spectrum Analyzer'],[80,40;110,40;110,80;140,80])
add_line([sys,'/','Spectrum Analyzer'],[80,120;110,120;110,95;140,95])
set_param([sys,'/','Spectrum Analyzer'],...
'Mask Display','plot(0,0,100,100,[11,93,93,11,11],[90,90,40,40,90],[90,80,72,64,55,45,41,36,20],[50,50,52,59,67,75,78,80,80])',...
'Mask Type','Spectrum analyzer.')
set_param([sys,'/','Spectrum Analyzer'],...
'Mask Dialogue','Spectrum analyser using graph window.\nHook input 1 to system input.\nHook input 2 to system output.|Length of buffer:|Number of points for fft:|Plot after how many points:|Sample time:')
set_param([sys,'/','Spectrum Analyzer'],...
'Mask Translate','npts=@1; fftpts=@2; HowOften=@3; ts=@4(1); if length(@4) > 1, offset = @4(2), else, offset = 0; end')
set_param([sys,'/','Spectrum Analyzer'],...
'Mask Help','Hook the system''s input to the first port of this block and the system''s output to second port. Results are displayed as the frequency response of this system. Use signals with high harmonic content for best results. ')
set_param([sys,'/','Spectrum Analyzer'],...
'Mask Entries','256\/256\/64\/0.1\/')
% Finished composite block 'Spectrum Analyzer'.
set_param([sys,'/','Spectrum Analyzer'],...
'Drop Shadow',4,...
'position',[55,160,85,200])
% Subsystem ['Power Spectral',13,'Sensity'].
new_system([sys,'/',['Power Spectral',13,'Sensity']])
set_param([sys,'/',['Power Spectral',13,'Sensity']],'Location',[0,0,276,140])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -