📄 tstqa2cd.m
字号:
function [ret,x0,str,ts,xts]=tstqa2cd(t,x,u,flag);
%TSTQA2CD is the M-file description of the SIMULINK system named TSTQA2CD.
% The block-diagram can be displayed by typing: TSTQA2CD.
%
% SYS=TSTQA2CD(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 TSTQA2CD 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 TSTQA2CD with a FLAG of zero:
% [SIZES]=TSTQA2CD([],[],[],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',[293,438,979,619])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '999')
set_param(sys,'Min step size', 'ts')
set_param(sys,'Max step size', 'ts')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
set_param(sys,'Load callback','ts=.01;[num,den]=butter(4,100/pi*ts);td=.2;M=64;');
% Subsystem ['QASK',13,'square-demap'].
new_system([sys,'/',['QASK',13,'square-demap']])
set_param([sys,'/',['QASK',13,'square-demap']],'Location',[57,374,831,674])
add_block('built-in/Abs',[sys,'/',['QASK',13,'square-demap/Abs']])
set_param([sys,'/',['QASK',13,'square-demap/Abs']],...
'position',[325,163,355,187])
add_block('built-in/Abs',[sys,'/',['QASK',13,'square-demap/Abs1']])
set_param([sys,'/',['QASK',13,'square-demap/Abs1']],...
'position',[325,38,355,62])
add_block('built-in/Constant',[sys,'/',['QASK',13,'square-demap/Shift key2']])
set_param([sys,'/',['QASK',13,'square-demap/Shift key2']],...
'BackGround',5,...
'position',[325,114,350,136])
add_block('built-in/Constant',[sys,'/',['QASK',13,'square-demap/Shift key1']])
set_param([sys,'/',['QASK',13,'square-demap/Shift key1']],...
'Value','sftx',...
'position',[220,89,245,111])
add_block('built-in/S-Function',[sys,'/',['QASK',13,'square-demap/Minimum1']])
set_param([sys,'/',['QASK',13,'square-demap/Minimum1']],...
'function name','arymimai',...
'parameters','''min''',...
'position',[385,40,445,60])
add_block('built-in/Constant',[sys,'/',['QASK',13,'square-demap/Shift key']])
set_param([sys,'/',['QASK',13,'square-demap/Shift key']],...
'Value','sfty',...
'position',[225,214,250,236])
add_block('built-in/S-Function',[sys,'/',['QASK',13,'square-demap/Minimum']])
set_param([sys,'/',['QASK',13,'square-demap/Minimum']],...
'function name','arymimai',...
'parameters','''min''',...
'position',[385,165,450,185])
add_block('built-in/Sum',[sys,'/',['QASK',13,'square-demap/Sum2']])
set_param([sys,'/',['QASK',13,'square-demap/Sum2']],...
'ForeGround',2,...
'inputs','+-',...
'position',[290,158,310,187])
add_block('built-in/Sum',[sys,'/',['QASK',13,'square-demap/Sum1']])
set_param([sys,'/',['QASK',13,'square-demap/Sum1']],...
'ForeGround',2,...
'inputs','+-',...
'position',[280,33,300,62])
add_block('built-in/Sum',[sys,'/',['QASK',13,'square-demap/Sum4']])
set_param([sys,'/',['QASK',13,'square-demap/Sum4']],...
'ForeGround',2,...
'position',[470,58,490,87])
add_block('built-in/Outport',[sys,'/',['QASK',13,'square-demap/out_1']])
set_param([sys,'/',['QASK',13,'square-demap/out_1']],...
'position',[685,80,705,100])
add_block('built-in/Saturation',[sys,'/',['QASK',13,'square-demap/Saturation']])
set_param([sys,'/',['QASK',13,'square-demap/Saturation']],...
'Lower Limit','0',...
'Upper Limit','N-1',...
'position',[630,78,660,102])
add_block('built-in/Sum',[sys,'/',['QASK',13,'square-demap/Sum3']])
set_param([sys,'/',['QASK',13,'square-demap/Sum3']],...
'ForeGround',2,...
'inputs','+-',...
'position',[580,73,600,102])
% Subsystem ['QASK',13,'square-demap/2-D Table'].
new_system([sys,'/',['QASK',13,'square-demap/2-D Table']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],'Location',[436,148,718,302])
add_block('built-in/Mux',[sys,'/',['QASK',13,'square-demap/2-D Table/Mux']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table/Mux']],...
'inputs','2',...
'position',[90,46,120,79])
add_block('built-in/S-Function',[sys,'/',['QASK',13,'square-demap/2-D Table/S-function']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table/S-function']],...
'function name','sftable2',...
'parameters','xindex, yindex, table',...
'position',[140,52,190,78])
add_block('built-in/Inport',[sys,'/',['QASK',13,'square-demap/2-D Table/x0']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table/x0']],...
'position',[20,25,40,45])
add_block('built-in/Outport',[sys,'/',['QASK',13,'square-demap/2-D Table/table out']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table/table out']],...
'position',[215,55,235,75])
add_block('built-in/Inport',[sys,'/',['QASK',13,'square-demap/2-D Table/y0']])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table/y0']],...
'Port','2',...
'position',[20,80,40,100])
add_line([sys,'/',['QASK',13,'square-demap/2-D Table']],[125,65;135,65])
add_line([sys,'/',['QASK',13,'square-demap/2-D Table']],[45,35;65,35;65,55;85,55])
add_line([sys,'/',['QASK',13,'square-demap/2-D Table']],[195,65;210,65])
add_line([sys,'/',['QASK',13,'square-demap/2-D Table']],[45,90;65,90;65,70;85,70])
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'Mask Display','plot(-10,-10,110,110,[90,50,10],[90,40,30],[90,50,10],[50,26,20],[90,50,10],[22,13,10])',...
'Mask Type','2-D Table Lookup')
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'Mask Dialogue','Two Dimensional Table Lookup\nThe first input corresponds to X Index and the second input corresponds to the Y Index|X Index|Y Index|Table')
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'Mask Translate','xindex=@1; yindex=@2; table=@3; sftab2chk(xindex,yindex,table);')
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'Mask Help','This block returns a linearly interpolated intersection from the table using the X index (which corresponds to the rows of the table) and the Y index (which corresponds to the columns of the table). Extrapolation is used.')
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'Mask Entries','x\/y\/tab\/')
% Finished composite block ['QASK',13,'square-demap/2-D Table'].
set_param([sys,'/',['QASK',13,'square-demap/2-D Table']],...
'position',[515,68,545,92])
add_block('built-in/Sum',[sys,'/',['QASK',13,'square-demap/Sum5']])
set_param([sys,'/',['QASK',13,'square-demap/Sum5']],...
'ForeGround',2,...
'position',[470,153,490,182])
add_block('built-in/Inport',[sys,'/',['QASK',13,'square-demap/in_2']])
set_param([sys,'/',['QASK',13,'square-demap/in_2']],...
'Port','2',...
'position',[60,155,80,175])
add_block('built-in/Zero-Order Hold',[sys,'/',['QASK',13,'square-demap/Zero-Order',13,'Hold1']])
set_param([sys,'/',['QASK',13,'square-demap/Zero-Order',13,'Hold1']],...
'Sample time','td',...
'position',[135,149,170,181])
add_block('built-in/Inport',[sys,'/',['QASK',13,'square-demap/in_1']])
set_param([sys,'/',['QASK',13,'square-demap/in_1']],...
'position',[60,30,80,50])
add_block('built-in/Zero-Order Hold',[sys,'/',['QASK',13,'square-demap/Zero-Order',13,'Hold']])
set_param([sys,'/',['QASK',13,'square-demap/Zero-Order',13,'Hold']],...
'Sample time','td',...
'position',[135,24,170,56])
add_line([sys,'/',['QASK',13,'square-demap']],[175,40;275,40])
add_line([sys,'/',['QASK',13,'square-demap']],[175,165;285,165])
add_line([sys,'/',['QASK',13,'square-demap']],[85,165;130,165])
add_line([sys,'/',['QASK',13,'square-demap']],[495,75;510,75])
add_line([sys,'/',['QASK',13,'square-demap']],[355,125;560,125;560,95;575,95])
add_line([sys,'/',['QASK',13,'square-demap']],[450,125;450,160;465,160])
add_line([sys,'/',['QASK',13,'square-demap']],[450,125;450,80;465,80])
add_line([sys,'/',['QASK',13,'square-demap']],[495,170;500,170;510,85])
add_line([sys,'/',['QASK',13,'square-demap']],[455,175;465,175])
add_line([sys,'/',['QASK',13,'square-demap']],[450,50;450,65;465,65])
add_line([sys,'/',['QASK',13,'square-demap']],[605,90;625,90])
add_line([sys,'/',['QASK',13,'square-demap']],[550,80;575,80])
add_line([sys,'/',['QASK',13,'square-demap']],[665,90;680,90])
add_line([sys,'/',['QASK',13,'square-demap']],[360,50;380,50])
add_line([sys,'/',['QASK',13,'square-demap']],[305,50;320,50])
add_line([sys,'/',['QASK',13,'square-demap']],[250,100;255,100;255,55;275,55])
add_line([sys,'/',['QASK',13,'square-demap']],[255,225;260,225;260,180;285,180])
add_line([sys,'/',['QASK',13,'square-demap']],[315,175;320,175])
add_line([sys,'/',['QASK',13,'square-demap']],[360,175;380,175])
add_line([sys,'/',['QASK',13,'square-demap']],[85,40;130,40])
set_param([sys,'/',['QASK',13,'square-demap']],...
'Mask Display','QASK\nS-demap',...
'Mask Type','QASK S-demap')
set_param([sys,'/',['QASK',13,'square-demap']],...
'Mask Dialogue','Reverse the QASK map. Input in-phase\nand quadrature components from the\ntwo inputs. Output demapped signal.|QASK M-ary number (outputs are in range [0, M-1]):|Output symbol interval and offset (sec):')
set_param([sys,'/',['QASK',13,'square-demap']],...
'Mask Translate','N=@1;td=@2;Ac=1;sftx=[1 -1 3 -3 5 -5 7 -7 9 -9 11 -11 13 -13 15 -15];sftx=sftx(1:2*ceil(sqrt(N)/2));sfty=sftx;if N==8,sfty=sfty(1:2);end;sftx=sftx/max(sftx)*Ac;sfty=sfty/max(sfty)*Ac;tab=qaskdeco(length(sftx),length(sfty),''fetch'')+1;x=[1:length(sftx)];y=[1:length(sfty)];')
set_param([sys,'/',['QASK',13,'square-demap']],...
'Mask Help','This block demaps a QASK mapped signal using square constellation. You can place this block after a QAM demodulation block. This block assumes the maximum amplitude of the input signals is 1. The output symbols are integers in the range [0, M-1]. The input symbol interval can be a two-element vector with the second element being offset. The default value offset is 0.')
set_param([sys,'/',['QASK',13,'square-demap']],...
'Mask Entries','M\/[td, td-ts]\/')
% Finished composite block ['QASK',13,'square-demap'].
set_param([sys,'/',['QASK',13,'square-demap']],...
'hide name',0,...
'position',[455,38,535,82])
% Subsystem ['QADM',13,'passband'].
new_system([sys,'/',['QADM',13,'passband']])
set_param([sys,'/',['QADM',13,'passband']],'Location',[194,478,738,741])
add_block('built-in/Outport',[sys,'/',['QADM',13,'passband/out_1']])
set_param([sys,'/',['QADM',13,'passband/out_1']],...
'position',[480,70,500,90])
add_block('built-in/Outport',[sys,'/',['QADM',13,'passband/out_2']])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -