📄 bpsnrzbw.m
字号:
add_block('built-in/Sum',[sys,'/','Kanal/Sum'])
set_param([sys,'/','Kanal/Sum'],...
'position',[150,55,170,75])
% Subsystem ['Kanal/Gaussian noise',13,'generator'].
new_system([sys,'/',['Kanal/Gaussian noise',13,'generator']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],'Location',[22,119,370,243])
add_block('built-in/State-Space',[sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'A','[]',...
'B','[]',...
'C','[]',...
'D','K',...
'Mask Display','K',...
'Mask Type','Matrix Gain',...
'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'Mask Translate','K = @1;',...
'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
'Mask Entries','d\/')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'position',[140,61,165,89])
add_block('built-in/White Noise',[sys,'/',['Kanal/Gaussian noise',13,'generator/Random',13,'Number']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Random',13,'Number']],...
'Seed','s',...
'position',[35,57,80,93])
add_block('built-in/Constant',[sys,'/',['Kanal/Gaussian noise',13,'generator/Constant']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Constant']],...
'Value','m',...
'position',[140,20,160,40])
add_block('built-in/Sum',[sys,'/',['Kanal/Gaussian noise',13,'generator/Sum']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Sum']],...
'position',[220,60,240,80])
add_block('built-in/Outport',[sys,'/',['Kanal/Gaussian noise',13,'generator/out_1']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/out_1']],...
'position',[285,60,305,80])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[165,30;190,30;190,65;215,65])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[245,70;280,70])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[170,75;215,75])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[85,75;135,75])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Display','plot(0,0,100,100,x,y);Gaussian',...
'Mask Type','Gaussian noise generator')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Dialogue','Generate Gaussian distributed noise with\ngiven mean and variance value.|Mean value:|Variance (vector or matrix):|Initial seed:')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=srcsicon(3);')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Help','When the mean value and seed are vectors, the output of this block is a vector. The length of the vector is the same as the length of the mean value vector or the length of the seed. When the variance entry is a vector, the variance is a diagonal matrix.')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Entries','m\/d\/s\/')
% Finished composite block ['Kanal/Gaussian noise',13,'generator'].
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'position',[25,48,105,92])
add_line([sys,'/','Kanal'],[175,65;195,65])
add_line([sys,'/','Kanal'],[70,20;115,20;115,60;145,60])
add_line([sys,'/','Kanal'],[110,70;145,70])
set_param([sys,'/','Kanal'],...
'Mask Display','plot(0,0,100,100,x,y);AWGN',...
'Mask Type','AWGN channel, fixed parameter')
set_param([sys,'/','Kanal'],...
'Mask Dialogue','Additive white Gaussian noise channel\nwith fixed mean and variance.|Mean value:|Variance (std^2):|Initial Seed:',...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=chanicon;')
set_param([sys,'/','Kanal'],...
'Mask Help','This block adds white Gaussian noise to the input signal. The mean and the variance can be a scalar or vector with the same length as the input signal.',...
'Mask Entries','0\/.001\/12345\/')
% Finished composite block 'Kanal'.
set_param([sys,'/','Kanal'],...
'position',[505,108,585,152])
add_block('built-in/Scope',[sys,'/','Empfangssignal r(t)'])
set_param([sys,'/','Empfangssignal r(t)'],...
'orientation',1,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[342,629,1278,729])
open_system([sys,'/','Empfangssignal r(t)'])
set_param([sys,'/','Empfangssignal r(t)'],...
'position',[585,215,615,245])
add_block('built-in/Scope',[sys,'/','Senkensignal v(t)'])
set_param([sys,'/','Senkensignal v(t)'],...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[341,920,1277,1020])
open_system([sys,'/','Senkensignal v(t)'])
set_param([sys,'/','Senkensignal v(t)'],...
'position',[990,110,1020,140])
add_block('built-in/Product',[sys,'/','Product1'])
set_param([sys,'/','Product1'],...
'hide name',0,...
'position',[640,113,670,137])
add_block('built-in/Scope',[sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
'orientation',1,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[341,824,1277,924])
open_system([sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
'position',[830,180,860,210])
add_block('built-in/Scope',[sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'move name',0,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[344,338,1279,438])
open_system([sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'position',[80,200,110,230])
% Subsystem ['Schwellenwert-',13,'Entscheider'].
new_system([sys,'/',['Schwellenwert-',13,'Entscheider']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],'Location',[159,417,467,586])
add_block('built-in/Constant',[sys,'/',['Schwellenwert-',13,'Entscheider/Constant']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Constant']],...
'Value','0',...
'position',[65,105,85,125])
add_block('built-in/Relational Operator',[sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator1']],...
'Operator','<',...
'position',[140,92,170,123])
add_block('built-in/Sum',[sys,'/',['Schwellenwert-',13,'Entscheider/Sum']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Sum']],...
'inputs','+-',...
'position',[215,64,235,91])
add_block('built-in/Relational Operator',[sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator']],...
'Operator','>',...
'position',[140,32,170,63])
add_block('built-in/Inport',[sys,'/',['Schwellenwert-',13,'Entscheider/in_1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/in_1']],...
'position',[35,30,55,50])
add_block('built-in/Outport',[sys,'/',['Schwellenwert-',13,'Entscheider/out_1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/out_1']],...
'position',[265,70,285,90])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[240,80;260,80])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[175,50;185,50;185,70;210,70])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[175,110;185,110;185,85;210,85])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[90,115;135,115])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[110,115;110,55;135,55])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[60,40;135,40])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[95,40;95,100;135,100])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
'Mask Display','plot(-50,-50,50,50,[-50,50],[0,0],[0,0],[-50,50],[-40,0],[-30,-30],[0,40],[30,30])',...
'Mask Type','Sign',...
'Mask Dialogue','y = sign(x)')
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
'Mask Help','Sign Function:\n\t\t\ty = 1 if x > 0\n\t\t\ty = 0 if x = 0\n\t\t\ty = -1 if x < 0')
% Finished composite block ['Schwellenwert-',13,'Entscheider'].
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
'position',[880,112,910,138])
% Subsystem 'Error rate'.
new_system([sys,'/','Error rate'])
set_param([sys,'/','Error rate'],'Location',[255,368,509,510])
add_block('built-in/Inport',[sys,'/','Error rate/in_2'])
set_param([sys,'/','Error rate/in_2'],...
'Port','2',...
'position',[15,60,35,80])
add_block('built-in/Inport',[sys,'/','Error rate/in_1'])
set_param([sys,'/','Error rate/in_1'],...
'position',[15,45,35,65])
add_block('built-in/Mux',[sys,'/','Error rate/Mux'])
set_param([sys,'/','Error rate/Mux'],...
'inputs','2',...
'position',[65,46,100,79])
add_block('built-in/S-Function',[sys,'/','Error rate/S-function'])
set_param([sys,'/','Error rate/S-function'],...
'function name','sbiterr',...
'parameters','num_lin, K, TDelay, Sample',...
'position',[130,52,195,78])
add_line([sys,'/','Error rate'],[40,70;60,70])
add_line([sys,'/','Error rate'],[40,55;60,55])
add_line([sys,'/','Error rate'],[105,65;125,65])
set_param([sys,'/','Error rate'],...
'Mask Display','Error\nmeter',...
'Mask Type','Symbol/bit error counter')
set_param([sys,'/','Error rate'],...
'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 signal.|Bit per symbol:|Number of digits on display:|Delay between 1st port and 2nd port:|Sample time (sec):')
set_param([sys,'/','Error rate'],...
'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate'],...
'Mask Help','The signal from the first port must be a scalar. The second input port can be a vector with a delay to the first port signal. The comparison happens only at the sampling point.')
set_param([sys,'/','Error rate'],...
'Mask Entries','1\/10\/1\/1\/')
% Finished composite block 'Error rate'.
set_param([sys,'/','Error rate'],...
'orientation',1,...
'position',[890,230,970,270])
add_block('built-in/Fcn',[sys,'/','Fcn'])
set_param([sys,'/','Fcn'],...
'hide name',0,...
'Expr','2*cos(4*pi*u)',...
'position',[525,22,620,48])
add_block('built-in/Clock',[sys,'/','Clock1'])
set_param([sys,'/','Clock1'],...
'hide name',0,...
'position',[485,25,505,45])
% Subsystem 'Doppelklick2'.
new_system([sys,'/','Doppelklick2'])
set_param([sys,'/','Doppelklick2'],'Location',[136,230,381,439])
set_param([sys,'/','Doppelklick2'],...
'Mask Display','Rauschen einstellen',...
'Mask Type','rauschen',...
'Mask Dialogue','eval(''setnoise'')')
% Finished composite block 'Doppelklick2'.
set_param([sys,'/','Doppelklick2'],...
'BackGround',7,...
'hide name',0,...
'Font Angle','italic',...
'position',[480,75,615,101])
add_line(sys,[260,160;270,160])
add_line(sys,[625,35;635,120])
add_line(sys,[510,35;520,35])
add_line(sys,[790,125;875,125])
add_line(sys,[915,125;985,125])
add_line(sys,[375,160;380,160;380,135;395,135])
add_line(sys,[435,130;500,130])
add_line(sys,[590,130;635,130])
add_line(sys,[45,125;395,125])
add_line(sys,[675,125;720,125])
add_line(sys,[190,125;190,195])
add_line(sys,[950,125;950,225])
add_line(sys,[190,125;190,30;220,30])
add_line(sys,[60,125;60,250;880,250;880,215;910,225])
add_line(sys,[60,215;75,215])
add_line(sys,[845,125;845,30;870,30])
add_line(sys,[845,125;845,175])
add_line(sys,[690,125;690,175])
add_line(sys,[600,130;600,210])
add_line(sys,[460,130;460,175])
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 + -