fig_source_received_signal.m

来自「张贤达老师 通信信号处理4-9章的程序 这本书是张老师的经典之作。」· M 代码 · 共 34 行

M
34
字号
%%%%%%%%%%%%%% The received signal over fading channel with 4 taps %%%%%%%%%

clear
N_s = 400;
M=16;                          % 16 QAM
SNR=20;                        % the signal-noise-ratio
sigma=1;                       % the source signal's standard deviation
s = make_qam(M,N_s,sigma);     % generate source signal

%%%%%%%%%%% channel 1 %%%%%%%%%%%%%%
   B=[0.2 0.5 1 -0.1];            % the channel's transfer function
   A=1;
   r=filter(B,A,s);               % the source passed through the channel, and this is the result

w=10^(-SNR/20)*1/sqrt(2)*(randn(1,N_s)+j*randn(1,N_s));           % the noise corresponds to the given SNR
x=r+w;                         % the received signal

% plotting commands follow

FONTSIZE=0.315;         % 单位为厘米;  
LINEWIDTH_AXES=1.2;%140/42;  % corresponding to 0.140mm 
LINEWIDTH_WAVE=0.5;%180/42;  % corresponding to 0.180mm
figNumber=figure('Name','Transmitted and Received Signal', 'Visible','on');
set(gcf,'Color','white');
subplot(1,2,1)
plot(s,'r*','LineWidth',LINEWIDTH_WAVE);  
set(gca,'XColor','blue','YColor','blue','FontUnits','centimeters','FontName','Times New Roman','FontSize',FONTSIZE,'LineWidth',LINEWIDTH_AXES);
set(figNumber,'PaperPosition',[0.634518 6.34518 20.3046*0.8 15.2284*0.8]);     %Shrink the figure size  

subplot(1,2,2)
plot(x,'r*','LineWidth',LINEWIDTH_WAVE)                % the output constellation plot
set(gca,'XColor','blue','YColor','blue','FontUnits','centimeters','FontName','Times New Roman','FontSize',FONTSIZE,'LineWidth',LINEWIDTH_AXES);
set(figNumber,'PaperPosition',[0.634518 6.34518 20.3046*0.8 15.2284*0.8]);     %Shrink the figure size  

⌨️ 快捷键说明

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