📄 tsteyes2.m
字号:
'Numerator','num',...
'Denominator','den',...
'Sample time','ts',...
'position',[390,61,445,99])
add_block('built-in/Note',[sys,'/',['QADM',13,'baseband/Ref: Hambley: An Intro to Comm. Systems. pp72']])
set_param([sys,'/',['QADM',13,'baseband/Ref: Hambley: An Intro to Comm. Systems. pp72']],...
'position',[285,280,290,285])
add_block('built-in/Outport',[sys,'/',['QADM',13,'baseband/out_1']])
set_param([sys,'/',['QADM',13,'baseband/out_1']],...
'position',[480,70,500,90])
add_line([sys,'/',['QADM',13,'baseband']],[165,115;230,115;230,60;255,60])
add_line([sys,'/',['QADM',13,'baseband']],[230,115;230,245;265,245])
add_line([sys,'/',['QADM',13,'baseband']],[185,255;200,255;200,140;255,140])
add_line([sys,'/',['QADM',13,'baseband']],[200,255;265,255])
add_line([sys,'/',['QADM',13,'baseband']],[165,130;255,130])
add_line([sys,'/',['QADM',13,'baseband']],[180,130;180,210;265,210])
add_line([sys,'/',['QADM',13,'baseband']],[180,50;255,50])
add_line([sys,'/',['QADM',13,'baseband']],[215,50;215,200;265,200])
add_line([sys,'/',['QADM',13,'baseband']],[295,55;305,55;305,75;330,75])
add_line([sys,'/',['QADM',13,'baseband']],[295,135;305,135;305,85;330,85])
add_line([sys,'/',['QADM',13,'baseband']],[305,205;315,205;315,225;335,225])
add_line([sys,'/',['QADM',13,'baseband']],[305,250;315,250;315,235;335,235])
add_line([sys,'/',['QADM',13,'baseband']],[80,125;115,125])
add_line([sys,'/',['QADM',13,'baseband']],[360,80;385,80])
add_line([sys,'/',['QADM',13,'baseband']],[450,80;475,80])
add_line([sys,'/',['QADM',13,'baseband']],[365,230;390,230])
add_line([sys,'/',['QADM',13,'baseband']],[455,230;480,230])
set_param([sys,'/',['QADM',13,'baseband']],...
'Mask Display','plot(0,0,100,100,x,y,u,v);QADM',...
'Mask Type','QM DSB-SC ADM CE')
set_param([sys,'/',['QADM',13,'baseband']],...
'Mask Dialogue','Demodulate the complex envelope of a\nQAM modulated signal into in-phase and\nquadrature components into 1st and 2nd\nout ports.|Lowpass filter numerator:|Lowpass filter denominator:|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['QADM',13,'baseband']],...
'Mask Translate','num=@1;den=@2;Ph=@3;ts=@4;x1=cos(-Ph);x2=sin(-Ph);[x,y]=moduicon(2);[u,v]=cmplxicn(0,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['QADM',13,'baseband']],...
'Mask Help','This block demodulates the quadratic multiplexed double-sideband suppressed-carrier amplitude modulation modulated signal using the QAM method. The filter to be specified is a lowpass filter that passes the signal message and eliminates the carrier signal.')
set_param([sys,'/',['QADM',13,'baseband']],...
'Mask Entries','num\/den\/0\/ts\/')
% Finished composite block ['QADM',13,'baseband'].
set_param([sys,'/',['QADM',13,'baseband']],...
'hide name',0,...
'position',[425,58,505,102])
% 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):|Repeat flag (1: repeat 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 reaches the end of the variable (eof), the block will cyclically output from the first row of the variable or output zeros based on the repeat flag 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,58,90,102])
add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
'hide name',0,...
'inputs','2',...
'position',[545,60,580,100])
% Subsystem ['Sample-time',13,'eye-diagram scatter1'].
new_system([sys,'/',['Sample-time',13,'eye-diagram scatter1']])
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],'Location',[165,242,460,428])
add_block('built-in/Inport',[sys,'/',['Sample-time',13,'eye-diagram scatter1/in_1']])
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1/in_1']],...
'position',[75,80,95,100])
add_block('built-in/S-Function',[sys,'/',['Sample-time',13,'eye-diagram scatter1/Plot1']])
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1/Plot1']],...
'function name','eyesampl',...
'parameters','time_range, boundary, kept_length, eye_line, scatter_line, two_d_line',...
'position',[130,70,200,110])
add_line([sys,'/',['Sample-time',13,'eye-diagram scatter1']],[100,90;125,90])
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'Mask Display','plot(0,0,100,100,x,y);',...
'Mask Type','Eye-diagram/scatter plot')
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'Mask Dialogue','Produce eye-pattern diagram and/or scatter plot.|[Symbol interval, plot offset, decision point offset]:|Lower and upper bound of in-coming signal (1x2 vector):|Number of saved traces:|Line-type for eye-pattern diagram (0 for no plot):|Line-type for scatter plot (0 for no plot):|Plot update sample time:')
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'Mask Translate','time_range=@1;boundary=@2;kept_length=@3;eye_line=@4;scatter_line=@5;two_d_line=@6;[x,y]=srcsicon(10);')
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'Mask Help','This plot opens one, or two plots by assigning the line type parameters. The scatter plot point is selected by the decision point in the first parameter entry. A decision line is drawn in the eye-pattern diagram. The plot is updated at the plot update sample time point.')
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'Mask Entries','[td, .05 .1]\/[-1.5 1.5]\/5\/''y-/r-''\/''y./g*''\/ts\/')
% Finished composite block ['Sample-time',13,'eye-diagram scatter1'].
set_param([sys,'/',['Sample-time',13,'eye-diagram scatter1']],...
'hide name',0,...
'position',[605,58,685,102])
% Subsystem ['Rayleigh noise',13,'channel CE'].
new_system([sys,'/',['Rayleigh noise',13,'channel CE']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],'Location',[496,318,758,464])
add_block('built-in/Inport',[sys,'/',['Rayleigh noise',13,'channel CE/in_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/in_1']],...
'position',[45,10,65,30])
% Subsystem ['Rayleigh noise',13,'channel CE/Gaussian',13,'noise'].
new_system([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],'Location',[73,221,421,374])
add_block('built-in/White Noise',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Random',13,'Number']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Random',13,'Number']],...
'Seed','s',...
'position',[35,72,80,108])
add_block('built-in/State-Space',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
'A','[]',...
'B','[]',...
'C','[]',...
'D','K',...
'Mask Display','K',...
'Mask Type','Matrix Gain')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
'Mask Dialogue','Matrix Gain.|Gain matrix:',...
'Mask Translate','K = @1;')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
'Mask Entries','d\/')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
'position',[130,76,155,104])
add_block('built-in/Constant',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Constant']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Constant']],...
'Value','m',...
'position',[155,35,175,55])
add_block('built-in/Sum',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Sum']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Sum']],...
'position',[240,75,260,95])
add_block('built-in/Outport',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/out_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/out_1']],...
'position',[295,75,315,95])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[180,45;210,45;210,80;235,80])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[85,90;125,90])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[160,90;235,90])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[265,85;290,85])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
'Mask Display','Gaussian\nnoise',...
'Mask Type','Gaussian noise.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
'Mask Dialogue','Gaussian distribution noise.|Mean value:|Standard deviation:|Initial Seed(s):',...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
'Mask Help','When the mean value, seed are vectors, the output of this block is a vector with the length of the vector same as the length of mean value vector or that of the seed.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
'Mask Entries','m\/d\/s\/')
% Finished composite block ['Rayleigh noise',13,'channel CE/Gaussian',13,'noise'].
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
'position',[10,50,85,90])
add_block('built-in/Outport',[sys,'/',['Rayleigh noise',13,'channel CE/out_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/out_1']],...
'position',[200,55,220,75])
add_block('built-in/Sum',[sys,'/',['Rayleigh noise',13,'channel CE/Sum']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Sum']],...
'position',[150,55,170,75])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[175,65;195,65])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[70,20;115,20;115,60;145,60])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[90,70;145,70])
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'Mask Display','plot(0,0,100,100,x,y,v,w,u,z);Rayl N',...
'Mask Type','Rayleigh noise channel, fixed parameter')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'Mask Dialogue','Additive Rayleigh noise channel for\nbaseband signal simulation. Input\nand output signals are complex.|sigma:|Seeds (1x2 vector):')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'Mask Translate','m=0;d=@1;d=d^2;s=@2;if length(s)<2,s=[s s+s];end;[x,y]=chanicon;[v,w]=cmplxicn(0,50,get_param(gcb,''orientation''));[u,z]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'Mask Help','This block adds Rayleigh noise to the transmitting signal. The input and output of this block are complex data. The Rayleigh noise is composed by two independant zero mean Gaussian noise. These two Gaussian components have the same standard deviation sigma.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'Mask Entries','.1\/[12345 54321]\/')
% Finished composite block ['Rayleigh noise',13,'channel CE'].
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
'hide name',0,...
'position',[325,58,405,102])
add_line(sys,[95,80;115,80])
add_line(sys,[410,80;420,80])
add_line(sys,[585,80;600,80])
add_line(sys,[310,80;320,80])
add_line(sys,[205,70;220,70])
add_line(sys,[205,90;220,90])
add_line(sys,[510,70;540,70])
add_line(sys,[510,90;540,90])
drawnow
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str,ts,xts] = feval(sys);
end
else
drawnow % Flash up the model and execute load callback
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -