📄 tmpqa2cd.m
字号:
function [ret,x0,str,ts,xts]=tmpqa2cd(t,x,u,flag);
%TMPQA2CD is the M-file description of the SIMULINK system named TMPQA2CD.
% The block-diagram can be displayed by typing: TMPQA2CD.
%
% SYS=TMPQA2CD(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 TMPQA2CD 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 TMPQA2CD with a FLAG of zero:
% [SIZES]=TMPQA2CD([],[],[],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',[45,116,715,313])
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=.04;[num,den]=butter(2,100/pi/2*ts);td=.2;M=64;');
% Subsystem ['ASK Mo//Dem',13,'demo1'].
new_system([sys,'/',['ASK Mo//Dem',13,'demo1']])
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],'Location',[175,552,335,697])
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],...
'Mask Display','View\nconstellation',...
'Mask Dialogue','eval(''modmap(''''qask'''',M)'')')
% Finished composite block ['ASK Mo//Dem',13,'demo1'].
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],...
'BackGround',7,...
'hide name',0,...
'position',[70,128,150,172])
% Subsystem ['Eye-diagram',13,'scatter plot'].
new_system([sys,'/',['Eye-diagram',13,'scatter plot']])
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],'Location',[165,242,460,428])
add_block('built-in/S-Function',[sys,'/',['Eye-diagram',13,'scatter plot/Plot1']])
set_param([sys,'/',['Eye-diagram',13,'scatter plot/Plot1']],...
'function name','eyediasi',...
'parameters','time_range, boundary, kept_length, eye_line, scatter_line, two_d_line',...
'position',[130,70,200,110])
add_block('built-in/Mux',[sys,'/',['Eye-diagram',13,'scatter plot/Mux']])
set_param([sys,'/',['Eye-diagram',13,'scatter plot/Mux']],...
'inputs','2',...
'position',[65,70,100,105])
add_block('built-in/Inport',[sys,'/',['Eye-diagram',13,'scatter plot/in_2']])
set_param([sys,'/',['Eye-diagram',13,'scatter plot/in_2']],...
'Port','2',...
'position',[20,115,40,135])
add_block('built-in/Inport',[sys,'/',['Eye-diagram',13,'scatter plot/in_1']])
set_param([sys,'/',['Eye-diagram',13,'scatter plot/in_1']],...
'position',[15,55,35,75])
add_line([sys,'/',['Eye-diagram',13,'scatter plot']],[105,90;125,90])
add_line([sys,'/',['Eye-diagram',13,'scatter plot']],[45,125;50,125;60,95])
add_line([sys,'/',['Eye-diagram',13,'scatter plot']],[40,65;45,65;45,80;60,80])
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'Mask Display','plot(0,0,100,100,x,y,v,w);',...
'Mask Type','Eye-diagram/scatter plot')
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'Mask Dialogue','Produce eye-pattern diagram/scatter\nplot/x-y plot with the rising edge of the second input as the decision line.|Eye-pattern plot time frame:|Lower and upper bound of in-coming signal (1x2 vector):|Number of saved traces:|Line-type for eye-pattern diagram (0 for no such plot):|Line-type for scatter plot (0 for no such plot):|Line-type for x-y plot (0 for no such plot):')
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'Mask Translate','time_range=@1;boundary=@2;kept_length=@3;eye_line=@4;scatter_line=@5;two_d_line=@6;[x,y]=srcsicon(10);[v,w]=trigicon(0,25,get_param(gcb,''orientation''),2);')
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'Mask Help','This plot opens one, two, or three plots by assigning the line type parameters. The scatter plot point is selected by the rising edge of a trigger signal. A decision line is drawn at the rising edge of the trigger signal.')
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'Mask Entries','td*2\/[-1.2 1.2]\/10\/''r-/g--/b-.''\/''y./g*/bo''\/0\/')
% Finished composite block ['Eye-diagram',13,'scatter plot'].
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'hide name',0,...
'position',[540,118,620,162])
% Subsystem ['Pulses divide',13,'same sample time'].
new_system([sys,'/',['Pulses divide',13,'same sample time']])
set_param([sys,'/',['Pulses divide',13,'same sample time']],'Location',[55,192,283,286])
add_block('built-in/Outport',[sys,'/',['Pulses divide',13,'same sample time/Outport']])
set_param([sys,'/',['Pulses divide',13,'same sample time/Outport']],...
'position',[160,35,180,55])
add_block('built-in/S-Function',[sys,'/',['Pulses divide',13,'same sample time/S-function1']])
set_param([sys,'/',['Pulses divide',13,'same sample time/S-function1']],...
'function name','homopuls',...
'parameters','samp_time, out_divid, offset',...
'position',[40,31,105,59])
add_line([sys,'/',['Pulses divide',13,'same sample time']],[110,45;155,45])
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'Mask Display','plot(0,0,100,100,x,y);Pulse',...
'Mask Type','Pulse generator')
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time / Divider.|Sample time (scalar, sec):|Divider (integer vector):|Offset (same length as Divider):')
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;[x,y]=srcsicon(2);')
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'Mask Help','This block generates a vector pulse. The output length is the same as the divider vector length. The ith element of the output has the sample time Sample_time/Divider(i). All elements in divider must be integers.')
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'Mask Entries','td\/1\/-ts\/')
% Finished composite block ['Pulses divide',13,'same sample time'].
set_param([sys,'/',['Pulses divide',13,'same sample time']],...
'hide name',0,...
'position',[325,128,405,172])
add_block('built-in/Mux',[sys,'/','Mux1'])
set_param([sys,'/','Mux1'],...
'hide name',0,...
'inputs','2',...
'position',[450,98,485,142])
% 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',[10,43,85,87])
% Subsystem 'Error rate1'.
new_system([sys,'/','Error rate1'])
set_param([sys,'/','Error rate1'],'Location',[255,368,509,510])
add_block('built-in/S-Function',[sys,'/','Error rate1/S-function'])
set_param([sys,'/','Error rate1/S-function'],...
'function name','sbiterr',...
'parameters','num_lin, K, TDelay, Sample',...
'position',[130,52,195,78])
add_block('built-in/Mux',[sys,'/','Error rate1/Mux'])
set_param([sys,'/','Error rate1/Mux'],...
'inputs','2',...
'position',[65,46,100,79])
add_block('built-in/Inport',[sys,'/','Error rate1/in_1'])
set_param([sys,'/','Error rate1/in_1'],...
'position',[15,45,35,65])
add_block('built-in/Inport',[sys,'/','Error rate1/in_2'])
set_param([sys,'/','Error rate1/in_2'],...
'Port','2',...
'position',[15,60,35,80])
add_line([sys,'/','Error rate1'],[105,65;125,65])
add_line([sys,'/','Error rate1'],[40,55;60,55])
add_line([sys,'/','Error rate1'],[40,70;60,70])
set_param([sys,'/','Error rate1'],...
'Mask Display','Error\nmeter',...
'Mask Type','Symbol/bit error counter')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -