📄 tmpps2cd.m
字号:
function [ret,x0,str,ts,xts]=tmpps2cd(t,x,u,flag);
%TMPPS2CD is the M-file description of the SIMULINK system named TMPPS2CD.
% The block-diagram can be displayed by typing: TMPPS2CD.
%
% SYS=TMPPS2CD(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 TMPPS2CD 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 TMPPS2CD with a FLAG of zero:
% [SIZES]=TMPPS2CD([],[],[],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',[110,83,882,302])
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=.02;td=.2;Fc=100/2/pi;NIR=[6 12 18 24 30 38];AIR=[1 1.93 2.88 3.83 4.78 6.05];PIR=zeros(1,6);[num,den]=butter(3,100/pi*ts);M=sum(NIR);');
% 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/cir'''',[6 12 18 24 30 38],[1 1.93 2.88 3.83 4.78 6.05],[0 0 0 0 0 0])'')')
% Finished composite block ['ASK Mo//Dem',13,'demo1'].
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],...
'BackGround',7,...
'hide name',0,...
'position',[80,128,160,172])
% 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/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_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_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',[385,138,465,182])
% 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/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_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/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/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_line([sys,'/',['Eye-diagram',13,'scatter plot']],[40,65;45,65;45,80;60,80])
add_line([sys,'/',['Eye-diagram',13,'scatter plot']],[45,125;50,125;60,95])
add_line([sys,'/',['Eye-diagram',13,'scatter plot']],[105,90;125,90])
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\/[-7 7]\/10\/0\/''m./g*/bo''\/0\/')
% Finished composite block ['Eye-diagram',13,'scatter plot'].
set_param([sys,'/',['Eye-diagram',13,'scatter plot']],...
'hide name',0,...
'position',[630,128,710,172])
add_block('built-in/Mux',[sys,'/','Mux1'])
set_param([sys,'/','Mux1'],...
'hide name',0,...
'inputs','2',...
'position',[525,98,560,147])
% Subsystem 'Error rate1'.
new_system([sys,'/','Error rate1'])
set_param([sys,'/','Error rate1'],'Location',[255,368,509,510])
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_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/Mux',[sys,'/','Error rate1/Mux'])
set_param([sys,'/','Error rate1/Mux'],...
'inputs','2',...
'position',[65,46,100,79])
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_line([sys,'/','Error rate1'],[40,70;60,70])
add_line([sys,'/','Error rate1'],[40,55;60,55])
add_line([sys,'/','Error rate1'],[105,65;125,65])
set_param([sys,'/','Error rate1'],...
'Mask Display','Error\nmeter',...
'Mask Type','Symbol/bit error counter')
set_param([sys,'/','Error rate1'],...
'Mask Dialogue','Use the input data from the 1st port as the reference signal to detect the number of errors and error rate of the 2nd port inputted signal.|Bit per symbol:|Number of digits on display:|Delay between input (1st port) and output (2nd port):|Sampling time (sec):')
set_param([sys,'/','Error rate1'],...
'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate1'],...
'Mask Help','The signal from the first port must be a scalar. The second input port can be a vector with a same-time delay to the input signal. The comparison happens only at the sampling point.')
set_param([sys,'/','Error rate1'],...
'Mask Entries','7\/20\/td\/td\/')
% Finished composite block 'Error rate1'.
set_param([sys,'/','Error rate1'],...
'hide name',0,...
'position',[635,33,715,77])
% 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])
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_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])
% 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/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_block('built-in/S-Function',[sys,'/',['Sampled read',13,'from wksp/Pulses deivide',13,'same sample time1/S-function1']])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -