ray.m

来自「用MATLAB语言实现QPSK调制的误码率性能分析」· M 代码 · 共 19 行

M
19
字号
 %function [ x1,y1 ] = ray(nd ,qifs)
function [ mag ] = ray(nd ,qifs)
if exist('ftype')~=1,    ftype =0;  end;	% check if filter type is defined
if ftype==0 
    %  define a frequency vector and a magnitude vector to simulate the classic 'bathtub' shape
    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 
end

x=randn(1,nd*qifs);	% make 2048 normally distributed random number for I and Q
y=randn(1,nd*qifs);
% z=sqrt(x.*x + y.*y);
x1=filter(B,1,x);	% filter the I and Q signals 
y1=filter(B,1,y);
R=x1+j.*y1;		% generate the complex baseband Rayleigh signal 
mag=abs(R);		% find magnitude of the signal 

⌨️ 快捷键说明

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