📄 rayleighfadingnoise3_jakesweightedquadraturesinusoids.m
字号:
% ray2.m
%
% Rayleigh fading simulator.
% Uses Jakes method of the summation of weighted quadrature sinusoids.
%
%
% Richard Wyrwas, 2 February 1995.
% plot labels added by Bill Cowley 4/97
disp('ray2: Jakes method: calculating weighted quadrature sinusoids ....');
disp(' with Fs =1kHz ');
j=sqrt(-1);
fm=100.0; %Max Doppler frequency in Hz
fs=1000; %Sample Frequency
ns=1024; %Number of samples
R=zeros(ns,1);
Mag=zeros(ns,1);
for x=1:ns
tm=x/fs;
I=0.0;
I=1.848*cos(0.983*2*pi*fm*tm);
I=I+1.414*cos(0.932*2*pi*fm*tm);
I=I+0.765*cos(0.850*2*pi*fm*tm);
I=I+0.0*cos(0.739*2*pi*fm*tm);
I=I-0.765*cos(0.603*2*pi*fm*tm);
I=I-1.414*cos(0.446*2*pi*fm*tm);
I=I-1.848*cos(0.247*2*pi*fm*tm);
I=I-2.000*cos(0.092*2*pi*fm*tm);
I=I+1.000*cos(1.000*2*pi*fm*tm);
Q=0.0;
Q=Q+0.765*cos(0.983*2*pi*fm*tm);
Q=Q+1.414*cos(0.932*2*pi*fm*tm);
Q=Q+1.848*cos(0.850*2*pi*fm*tm);
Q=Q+2.000*cos(0.739*2*pi*fm*tm);
Q=Q+1.848*cos(0.603*2*pi*fm*tm);
Q=Q+1.414*cos(0.446*2*pi*fm*tm);
Q=Q+0.765*cos(0.247*2*pi*fm*tm);
Q=Q+0.000*cos(0.092*2*pi*fm*tm);
Q=Q+1.000*cos(1.000*2*pi*fm*tm);
R(x) = I+j*Q;
Mag(x)=abs(R(x));
end;
hist(Mag,20);
title('Histogram of Simulated Signal Magnitudes');
pause;
plot(Mag);
title('Plot of Simulated Signal Magnitude versus sample number')
pause;
axis([100,300,0,10]);
pause;
[Pxx,f]=psd(R,[],fs);
% psd(R,[],fs);
plot(f-fs/2,fftshift(Pxx));
title('Spectral Estimate of simulated signal');
xlabel('Frequency (Hz) ');
pause;
%y=10*log10(max(Pxx));
%axis([0.0,1.1*fm,-40,y]);
%xlabel('Frequencies to 10% greater than max doppler');
%pause;
%plot(abs(fft(R)));
%plot(f-fs/2,fftshift(abs(fft(R))));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -