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

📄 ray1.asv

📁 QPSK调制以及误码率计算程序
💻 ASV
字号:
% ray1.m 
% Rayleigh fading simulator
% Uses the method of filtering complex Gaussians with approximate doppler spread.
%
% These variables may be defined before the program runs:
%   ftype   type of shaping filter used (default =0 gives predefined bathtub curve)
%           otherwise ftype = >0 to 0.5 is the normalised LPF cutoff
%
% Richard Wyrwas, 2 February 1995,  with additions by Bill Cowley 4/97 

%disp('ray1: Rayleigh signal simulation by filtering random I and Q signals.');
%disp('(press space to continue)');

function [iout,qout]=RAY1(iin,qin)
if exist('ftype')~=1,    ftype =0;  end;	% check if filter type is defined
if ftype==0 
    %disp('Using predefined bathtub shape')
    %  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];
    %plot(f,m);
    %title('Desired magnitude response of I and Q shaping filters');
    %xlabel(' Frequency normalised by Fs/2');
    %pause;
    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,2000);	% make 2000 normally distributed random number for I and Q
y=randn(1,2000);
% z=sqrt(x.*x + y.*y);
iout=filter(B,1,x);	% filter the I and Q signals 
qout=filter(B,1,y);
%R=x1+j.*y1;		% generate the complex baseband Rayleigh signal 

%Mag=abs(R);		% find magnitude of the signal 

%hist(Mag,20);
%title('Histogram of simulated Rayleigh complex baseband signal')
%xlabel(' Signal magnitude ');
%pause;

%plot(Mag);
%title('Magnitude of the simulated Rayleigh signal')
%xlabel(' Sample Number');
%pause;
%axis([100,300,0,max(Mag)]);
%title('Magnitude of the simulated Rayleigh signal over 200 samples');
%pause;

%psd(R);
%[Pxx,fr]=psd(R);
%pause;
%plot(fr-1.0,fftshift(Pxx));
%title('Power Spectral Estimate (2 sided) of the Simulated Rayleigh Signal')
%xlabel('Normalised frequency');

%pause;
%plot(abs(fft(R)));

⌨️ 快捷键说明

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