📄 tcemqas2.m
字号:
function [ret,x0,str,ts,xts]=tcemqas2(t,x,u,flag);
%TCEMQAS2 is the M-file description of the SIMULINK system named TCEMQAS2.
% The block-diagram can be displayed by typing: TCEMQAS2.
%
% SYS=TCEMQAS2(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 TCEMQAS2 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 TCEMQAS2 with a FLAG of zero:
% [SIZES]=TCEMQAS2([],[],[],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',[81,517,668,686])
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;td=.2;M=8;Fc=100/2/pi;[num,den]=butter(4,100/pi*ts);');
% Subsystem ['Sampled read',13,'from wksp'].
new_system([sys,'/',['Sampled read',13,'from wksp']])
set_param([sys,'/',['Sampled read',13,'from wksp']],'Location',[355,528,737,675])
% Subsystem ['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1'].
new_system([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],'Location',[55,192,283,286])
add_block('built-in/S-Function',[sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/S-function1']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/S-function1']],...
'function name','homopuls',...
'parameters','samp_time, out_divid, offset',...
'position',[40,31,105,59])
add_block('built-in/Outport',[sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/Outport']])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/Outport']],...
'position',[160,35,180,55])
add_line([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Display','Vector\nPulse',...
'Mask Type','Pulse generator')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time ./Divider. |Sample time (scalar, sec):|Divider (integer vector):|Offset (have same dimension as Divider:')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Help','This block generator a vector pulses. The output length is the same as the vector defined in "Divider". The ith element of the output has the sample time Sample_time/Divider(i). All elements in "Divider" must be integers.')
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'Mask Entries','ts\/1\/off\/')
% Finished composite block ['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1'].
set_param([sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1']],...
'position',[50,56,110,94])
add_block('built-in/Outport',[sys,'/',['Sampled read',13,'from wksp/out_1']])
set_param([sys,'/',['Sampled read',13,'from wksp/out_1']],...
'position',[295,65,315,85])
add_block('built-in/S-Function',[sys,'/',['Sampled read',13,'from wksp/Message source']])
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'BackGround',5,...
'function name','trigwksp',...
'parameters','var,thd,cyclFlag,ini',...
'Mask Display','Triggered\nread',...
'Mask Type','Read from workspace')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Dialogue','The raising edge of input pulse trigger the block output the next row from the workspace variable.|Read the variable:|Threshold for the input pulse:|Cyclic read variable (1) or amend zeros (0).|Output before first trigger:')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Translate','var=@1;thd=@2;cyclFlag=@3;ini=@4;')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'Mask Help','This block reads the data from a workspace variable. The output is refreshed at the raising edge of the input pulse.',...
'Mask Entries','var\/.1\/cyc\/ini\/')
set_param([sys,'/',['Sampled read',13,'from wksp/Message source']],...
'position',[180,53,255,97])
add_line([sys,'/',['Sampled read',13,'from wksp']],[260,75;290,75])
add_line([sys,'/',['Sampled read',13,'from wksp']],[115,75;175,75])
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Display','plot(0,0,100,100,x,y);Rd wksp',...
'Mask Type','Read from workspace')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Dialogue','Read from a workspace variable at\nsampling time point.|Variable (column_number=block_output_length):|Data output sample time (sec):|Cyclic control (1: cyclic read, 0: output zeros after eof).|Initial output:')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Translate','var=@1;td=@2;ts=td(1);if (length(td)>=2),off=td(2);else off=0;end;cyc=@3;ini=@4;[x,y]=srcsicon(7);')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Help','This block reads from a workspace variable at a given sample time. The column number is the block output vector length. When the simulation reached the end of the variable (eof) row, the block will cyclically output from the first row of the variable or output zeros based on the cyclic control entree.')
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'Mask Entries','randint(300,1,M)\/td\/1\/0\/')
% Finished composite block ['Sampled read',13,'from wksp'].
set_param([sys,'/',['Sampled read',13,'from wksp']],...
'hide name',0,...
'position',[25,43,100,87])
% Subsystem ['S-map QASK',13,'mod baseband'].
new_system([sys,'/',['S-map QASK',13,'mod baseband']])
set_param([sys,'/',['S-map QASK',13,'mod baseband']],'Location',[13,347,333,487])
add_block('built-in/Inport',[sys,'/',['S-map QASK',13,'mod baseband/in_1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/in_1']],...
'position',[5,65,20,85])
add_block('built-in/Outport',[sys,'/',['S-map QASK',13,'mod baseband/out_1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/out_1']],...
'position',[275,65,295,85])
% Subsystem ['S-map QASK',13,'mod baseband/QASK',13,'square-map'].
new_system([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],'Location',[214,372,642,541])
add_block('built-in/Look Up Table',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/c-y axis']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/c-y axis']],...
'Input_Values','z',...
'Output_Values','y',...
'position',[245,90,280,120])
add_block('built-in/Outport',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/out_2']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/out_2']],...
'Port','2',...
'position',[325,95,345,115])
add_block('built-in/Look Up Table',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/s-x axis']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/s-x axis']],...
'Input_Values','z',...
'Output_Values','x',...
'position',[245,25,280,55])
add_block('built-in/Outport',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/out_1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/out_1']],...
'position',[325,30,345,50])
add_block('built-in/Zero-Order Hold',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/Zero-Order',13,'Hold']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/Zero-Order',13,'Hold']],...
'Sample time','td',...
'position',[110,24,145,56])
add_block('built-in/Inport',[sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/in_1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map/in_1']],...
'position',[45,30,65,50])
add_line([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],[70,40;105,40])
add_line([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],[150,40;240,40])
add_line([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],[185,40;185,105;240,105])
add_line([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],[285,105;320,105])
add_line([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],[285,40;320,40])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'Mask Display','QASK\nS-map',...
'Mask Type','QASK S-map')
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'Mask Dialogue','Use square constellation to map the\ninput digital signal into in-phase and\nquadrature components. M must be\nM=2^K with integer K.|M-ary number (input integers in range [0, M-1]):|Input symbol interval and offset (sec):')
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'Mask Translate','N=@1;Ac=1;td=@2;z=[[1:N];[1:N]];z=z(:);[x,y]=qaskenco(z-1,N);z=z-1.5;z=[z(2:2*N);N-.5];x=x/max(x);y=y/max(y);')
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'Mask Help','This block maps a digital signal onto in-phase and quadratic components, which are outputs in the first and second output port respectively. The M-ary number must be M=2^K with integer K. The input symbol interval can be a two-element vector with the second element being offset. The default value offset is 0. The maximum amplitudes for the outputs are 1.')
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'Mask Entries','M\/td\/')
% Finished composite block ['S-map QASK',13,'mod baseband/QASK',13,'square-map'].
set_param([sys,'/',['S-map QASK',13,'mod baseband/QASK',13,'square-map']],...
'hide name',0,...
'position',[50,53,130,97])
% Subsystem ['S-map QASK',13,'mod baseband/QAM',13,'baseband'].
new_system([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband']],'Location',[321,500,954,793])
add_block('built-in/Note',[sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/R1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/R1']],...
'position',[190,15,195,20])
add_block('built-in/Product',[sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Product']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Product']],...
'position',[300,33,330,57])
add_block('built-in/Product',[sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Product1']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Product1']],...
'position',[300,93,330,117])
add_block('built-in/Sum',[sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Sum']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/Sum']],...
'inputs','+-',...
'position',[375,60,395,80])
add_block('built-in/Note',[sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/R_out']])
set_param([sys,'/',['S-map QASK',13,'mod baseband/QAM',13,'baseband/R_out']],...
'position',[445,45,450,50])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -