ray.m

来自「qpsk在raylaigh信道下的误码率曲线」· M 代码 · 共 39 行

M
39
字号
% Progamme 2
% ray.m 
% Rayleigh fading simulator
function [iout,qout]=ray(iin,qin);
if exist('ftype')~=1    
    ftype =0;  
end	% check if filter type is defined
if ftype==0 
    f=(0.0:0.05:1.0);
    m=[1.0,1.2,1.5,1.9,2.8,4.0,6.0,9.0,15.0,25.0,1.00,0.05,0.03,0.02,0.01,0.005,0.005,0.005,0.005,0.005,0.005];
     B=fir2(16,f,m);		% design an FIR filter based on the shape above. 
else 
    B=fir1(60, ftype*2);	% design LPF using ftype as Fcutoff/Fs 
    disp('Using flat LPF Fc/Fs given by ftype');
    freqz(B, 1);		% plot response 
    title('Response of shaping filter');
    pause;
end

x=randn(1,1000);	% make 1000 normally distributed random number for I and Q
y=randn(1,1000);
iout=filter(B,1,x);	% filter the I and Q signals 
qout=filter(B,1,y);
R=iout+j.*qout;		% generate the complex baseband Rayleigh signal 
Mag=abs(R);		% find magnitude of the signal 
%************************* Raylaigh fading 图形 **************************
subplot(2,2,1);
plot(iout);
title('Raylaigh fading I signal');

subplot(2,2,2);
plot(qout);
title('Raylaigh fading Q signal');

subplot(2,2,3);
plot(Mag);
title('Raylaigh fading I+Q signal');

⌨️ 快捷键说明

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