⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsttcm.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
add_line([sys,'/',['K-step',13,'delay1']],[190,90;195,90;195,120;265,120])
add_line([sys,'/',['K-step',13,'delay1']],[45,90;55,90])
add_line([sys,'/',['K-step',13,'delay1']],[300,130;320,130])
set_param([sys,'/',['K-step',13,'delay1']],...
		'Mask Display','    -k\nz   ',...
		'Mask Type','Multi-step delay',...
		'Mask Dialogue','Output is K-step delay of the input signal.|Delay steps (integer):|Sample time (sec):|Initial output:')
set_param([sys,'/',['K-step',13,'delay1']],...
		'Mask Translate','n=@1;ts=@2;if length(ts)<2, ts=[ts 0];end;ini=@3;')
set_param([sys,'/',['K-step',13,'delay1']],...
		'Mask Help','This block holds the input signal for K steps and then outputs the signal. The delay step cannot be changed during the simulation.',...
		'Mask Entries','3*2\/1/2\/0\/')


%     Finished composite block ['K-step',13,'delay1'].

set_param([sys,'/',['K-step',13,'delay1']],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[475,288,555,332])


%     Subsystem  ['Binary vector',13,'convol decode1'].

new_system([sys,'/',['Binary vector',13,'convol decode1']])
set_param([sys,'/',['Binary vector',13,'convol decode1']],'Location',[719,297,1227,483])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol decode1/in_1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/in_1']],...
		'position',[65,35,85,55])


%     Subsystem  ['Binary vector',13,'convol decode1/Rising edge',13,'detector'].

new_system([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],'Location',[282,116,671,290])

add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator']],...
		'position',[135,18,165,42])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/in_1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/in_1']],...
		'position',[10,15,30,35])

add_block('built-in/Memory',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Memory1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Memory1']],...
		'position',[125,80,165,110])

add_block('built-in/Constant',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/one1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/one1']],...
		'Value','thld',...
		'position',[30,135,60,155])

add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator2']],...
		'Operator','>',...
		'position',[265,23,295,47])

add_block('built-in/Relational Operator',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/Relational',13,'Operator1']],...
		'position',[200,88,230,112])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector/out_1']],...
		'position',[340,25,360,45])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[300,35;335,35])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],[45,25;45,95;120,95])
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],...
		'Mask Display','Edge\nDetector',...
		'Mask Type','Edge Detection',...
		'Mask Dialogue','Rising edge detection:|Threshold:')
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],...
		'Mask Translate','thld=@1;',...
		'Mask Help','When the input signal rising edge passed the given shreshold, this block outputs one, otherwise outputs zero.')
set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],...
		'Mask Entries','thd\/')


%     Finished composite block ['Binary vector',13,'convol decode1/Rising edge',13,'detector'].

set_param([sys,'/',['Binary vector',13,'convol decode1/Rising edge',13,'detector']],...
		'position',[75,112,130,148])

add_block('built-in/Mux',[sys,'/',['Binary vector',13,'convol decode1/Mux']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Mux']],...
		'inputs','[tf(1,size(tf,2)), 1]',...
		'Mask Display','',...
		'position',[170,36,205,69])

add_block('built-in/S-Function',[sys,'/',['Binary vector',13,'convol decode1/Modulo',13,'operation1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Modulo',13,'operation1']],...
		'function name','sviterbi',...
		'parameters','tf, leng, tran_prob, plot_flag,v1,v2,v3,v4',...
		'position',[235,40,280,70])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'convol decode1/out_2']])
set_param([sys,'/',['Binary vector',13,'convol decode1/out_2']],...
		'Port','2',...
		'position',[445,65,465,85])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'convol decode1/out_1']])
set_param([sys,'/',['Binary vector',13,'convol decode1/out_1']],...
		'position',[405,35,425,55])

add_block('built-in/Demux',[sys,'/',['Binary vector',13,'convol decode1/Demux']])
set_param([sys,'/',['Binary vector',13,'convol decode1/Demux']],...
		'outputs','[tf(2,size(tf,2)), 1]',...
		'position',[305,35,345,70])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'convol decode1/in_2']])
set_param([sys,'/',['Binary vector',13,'convol decode1/in_2']],...
		'Port','2',...
		'position',[30,120,50,140])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[55,130;70,130])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[285,55;300,55])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[350,45;400,45])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[350,60;375,60;375,75;440,75])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[210,55;230,55])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[90,45;165,45])
add_line([sys,'/',['Binary vector',13,'convol decode1']],[135,130;140,130;140,60;165,60])
set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'Mask Display','plot(0,0,100,100,x,y,v,w);Convl de',...
		'Mask Type','Vector I/O convolution decode')
set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'Mask Dialogue','Convolution decode with codeword length\nN and message length K. Transfer function\nmatrix is a K-by-N matrix.|Transfer function (or SIMULINK diagram):|Path memory length (delay=path_length*K*T_out):|Transfer probability (3 row matrix, 0 for hard decision):|Trellis figure plot length (0 for no plot):|Trigger signal threshold:')
set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'Mask Translate','gen=@1;leng=@2;tran_prob=@3;plot_flag=@4;thd=@5;[tf,v2,v3,v4,v5,v6,M,nss]=simviter(gen);[x,y]=codeicon(2);[v,w]=trigicon(0,25,get_param(gcb,''orientation''),2);v1=zeros(7,1);v2=zeros(nss,1);v3=zeros(nss^2*leng,1);v4=zeros(nss,1);tf=simviter(gen);')
set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'Mask Help','This block decodes length N binary vector convolution code codeword into length K binary vector message using Viterbi algorithm. The block refreshes its register memory and decoding output at the rising edge of the second inport pulse. The second outport outputs the metric value for soft decision or the accumulative distance for hard\ndecision.')
set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'Mask Entries','''ungerboe''\/3\/0\/0\/.5\/')


%     Finished composite block ['Binary vector',13,'convol decode1'].

set_param([sys,'/',['Binary vector',13,'convol decode1']],...
		'hide name',0,...
		'position',[370,248,450,292])


%     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','.01\/[12345 54321]\/')


%     Finished composite block ['Rayleigh noise',13,'channel CE'].

set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'hide name',0,...
		'position',[340,128,420,172])
add_line(sys,[225,55;245,55])
add_line(sys,[685,65;695,65;695,110;130,110;130,150;145,150])
add_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -