📄 com_sync.m
字号:
function [ret,x0,str,ts,xts]=com_sync(t,x,u,flag);
%COM_SYNC is the M-file description of the SIMULINK system named COM_SYNC.
% The block-diagram can be displayed by typing: COM_SYNC.
%
% SYS=COM_SYNC(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 COM_SYNC 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 COM_SYNC with a FLAG of zero:
% [SIZES]=COM_SYNC([],[],[],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',[183,146,575,374])
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 ['Phase-Locked',13,'Loop demo'].
new_system([sys,'/',['Phase-Locked',13,'Loop demo']])
set_param([sys,'/',['Phase-Locked',13,'Loop demo']],'Location',[175,552,335,697])
set_param([sys,'/',['Phase-Locked',13,'Loop demo']],...
'Mask Display','PLL\ndemo',...
'Mask Dialogue','eval(''tstpll'')')
% Finished composite block ['Phase-Locked',13,'Loop demo'].
set_param([sys,'/',['Phase-Locked',13,'Loop demo']],...
'BackGround',7,...
'hide name',0,...
'position',[280,48,360,92])
% Subsystem ['Baseband model',13,'for PLL'].
new_system([sys,'/',['Baseband model',13,'for PLL']])
set_param([sys,'/',['Baseband model',13,'for PLL']],'Location',[372,67,987,246])
add_block('built-in/Gain',[sys,'/',['Baseband model',13,'for PLL/Gain1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Gain1']],...
'Gain','pi2',...
'position',[145,13,175,47])
add_block('built-in/Gain',[sys,'/',['Baseband model',13,'for PLL/Gain']])
set_param([sys,'/',['Baseband model',13,'for PLL/Gain']],...
'orientation',2,...
'Gain','pi2',...
'position',[260,88,290,122])
add_block('built-in/Transfer Fcn',[sys,'/',['Baseband model',13,'for PLL/Filter']])
set_param([sys,'/',['Baseband model',13,'for PLL/Filter']],...
'Numerator','Fn',...
'Denominator','Fd',...
'position',[420,16,470,54])
add_block('built-in/Inport',[sys,'/',['Baseband model',13,'for PLL/in_1']])
set_param([sys,'/',['Baseband model',13,'for PLL/in_1']],...
'position',[15,20,35,40])
% Subsystem ['Baseband model',13,'for PLL/Module',13,'integrator1'].
new_system([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],'Location',[196,490,621,627])
add_block('built-in/Inport',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/in_1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/in_1']],...
'position',[35,15,55,35])
add_block('built-in/Memory',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Memory']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Memory']],...
'orientation',2,...
'x0','init',...
'position',[210,75,260,105])
add_block('built-in/Fcn',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/module']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/module']],...
'Expr','rem(u[1],modu)',...
'position',[235,29,325,51])
add_block('built-in/Reset Integrator',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Reset',13,'integrator']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Reset',13,'integrator']],...
'position',[110,19,150,51])
add_block('built-in/Constant',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/one']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/one']],...
'orientation',3,...
'move name',0,...
'position',[70,55,90,75])
add_block('built-in/Sum',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Sum']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/Sum']],...
'position',[195,30,215,50])
add_block('built-in/Outport',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/out_1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1/out_1']],...
'position',[370,30,390,50])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[205,90;180,90;190,45])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[155,35;190,35])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[220,40;230,40])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[330,40;365,40])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[60,25;105,25])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[80,50;80,35;105,35])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],[340,40;340,90;265,90])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],...
'Mask Display','Mod\nint',...
'Mask Type','Module Integrator',...
'Mask Dialogue','Module the given number when state exceed limit|Module bound:|Initial value:')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],...
'Mask Translate','init=@2; modu=@1;')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],...
'Mask Help','The absolute value of this integrator will not exceed the specified module bound. The state value is set to be zero when the module bound is reached. This block can only be used for scale value calculation.')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],...
'Mask Entries','1\/0\/')
% Finished composite block ['Baseband model',13,'for PLL/Module',13,'integrator1'].
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator1']],...
'orientation',2,...
'position',[330,85,380,125])
add_block('built-in/Outport',[sys,'/',['Baseband model',13,'for PLL/Estimated',13,'phase']])
set_param([sys,'/',['Baseband model',13,'for PLL/Estimated',13,'phase']],...
'position',[580,25,600,45])
add_block('built-in/Gain',[sys,'/',['Baseband model',13,'for PLL/Gain3']])
set_param([sys,'/',['Baseband model',13,'for PLL/Gain3']],...
'Gain','G',...
'position',[520,22,545,48])
% Subsystem ['Baseband model',13,'for PLL/Module',13,'integrator'].
new_system([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],'Location',[196,490,621,627])
add_block('built-in/Outport',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/out_1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/out_1']],...
'position',[370,30,390,50])
add_block('built-in/Sum',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Sum']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Sum']],...
'position',[195,30,215,50])
add_block('built-in/Constant',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/one']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/one']],...
'orientation',3,...
'move name',0,...
'position',[70,55,90,75])
add_block('built-in/Reset Integrator',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Reset',13,'integrator']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Reset',13,'integrator']],...
'position',[110,19,150,51])
add_block('built-in/Fcn',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/module']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/module']],...
'Expr','rem(u[1],modu)',...
'position',[235,29,325,51])
add_block('built-in/Memory',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Memory']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/Memory']],...
'orientation',2,...
'x0','init',...
'position',[210,75,260,105])
add_block('built-in/Inport',[sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/in_1']])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator/in_1']],...
'position',[35,15,55,35])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[330,40;365,40])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[340,40;340,90;265,90])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[80,50;80,35;105,35])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[60,25;105,25])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[220,40;230,40])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[155,35;190,35])
add_line([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],[205,90;180,90;190,45])
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],...
'Mask Display','Mod\nint',...
'Mask Type','Module Integrator',...
'Mask Dialogue','Module the given number when state exceed limit|Module bound:|Initial value:')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],...
'Mask Translate','init=@2; modu=@1;')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],...
'Mask Help','The absolute value of this integrator will not exceed the specified module bound. The state value is set to be zero when the module bound is reached. This block can only be used for scale value calculation.')
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],...
'Mask Entries','1\/0\/')
% Finished composite block ['Baseband model',13,'for PLL/Module',13,'integrator'].
set_param([sys,'/',['Baseband model',13,'for PLL/Module',13,'integrator']],...
'position',[65,12,115,48])
add_block('built-in/Sum',[sys,'/',['Baseband model',13,'for PLL/Sum']])
set_param([sys,'/',['Baseband model',13,'for PLL/Sum']],...
'inputs','+-',...
'position',[220,25,240,45])
add_block('built-in/Gain',[sys,'/',['Baseband model',13,'for PLL/Gain2']])
set_param([sys,'/',['Baseband model',13,'for PLL/Gain2']],...
'Gain','Kc',...
'position',[340,20,385,50])
add_block('built-in/Fcn',[sys,'/',['Baseband model',13,'for PLL/Fcn']])
set_param([sys,'/',['Baseband model',13,'for PLL/Fcn']],...
'position',[270,25,310,45])
add_line([sys,'/',['Baseband model',13,'for PLL']],[315,35;335,35])
add_line([sys,'/',['Baseband model',13,'for PLL']],[245,35;265,35])
add_line([sys,'/',['Baseband model',13,'for PLL']],[475,35;505,35;505,105;385,105])
add_line([sys,'/',['Baseband model',13,'for PLL']],[505,35;515,35])
add_line([sys,'/',['Baseband model',13,'for PLL']],[325,105;295,105])
add_line([sys,'/',['Baseband model',13,'for PLL']],[120,30;140,30])
add_line([sys,'/',['Baseband model',13,'for PLL']],[550,35;575,35])
add_line([sys,'/',['Baseband model',13,'for PLL']],[390,35;415,35])
add_line([sys,'/',['Baseband model',13,'for PLL']],[180,30;215,30])
add_line([sys,'/',['Baseband model',13,'for PLL']],[255,105;200,105;200,40;215,40])
add_line([sys,'/',['Baseband model',13,'for PLL']],[40,30;60,30])
set_param([sys,'/',['Baseband model',13,'for PLL']],...
'Mask Display','Baseband\nPLL',...
'Mask Type','Baseband PLL model')
set_param([sys,'/',['Baseband model',13,'for PLL']],...
'Mask Dialogue','Output the phase shifting of the input\nsignal from the oscillation frequency.|Lowpass filter numerator:|Lowpass filter denominator:|Oscillation frequency (Hz):|Oscillation amplitude:|Gain at the output:')
set_param([sys,'/',['Baseband model',13,'for PLL']],...
'Mask Translate','Fn=@1;Fd=@2;Fc=@3;pi2=2*pi;Kc=@4/2;G=@5;')
set_param([sys,'/',['Baseband model',13,'for PLL']],...
'Mask Help','this block is used to detect the phase shifting of the input signal. The input to this block is an oscillation signal with possible phase shifting. The block detects the phase shifting value using the PLL technique. Design the lowpass filter to pass the phase changing signal and to eliminate the oscillation signal.')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -