clear;
close all
clc;
fm=0.02;
M=128;
dt=10;
N=100000;
T=N*dt-dt;
t=0:dt:T;
power=1; % scaling factor of power
x=0;
y=0;
for n=1:M-1
alpha=fm*cos(pi*n/(2*M-1));
% c=2*power./sqrt(M-1/2).*[[sin(pi*n/(M-1)) 1/2]',[cos(pi*n/(M-1)) 1/2]'];
c1=2*power./sqrt(M-1/2).*sin(pi*n/(M-1));
c2=2*power./sqrt(M-1/2).*cos(pi*n/(M-1)) ;
% c=(c1+c2)/2;
% sigma=sigma+c.^2/2
ph1=2*pi*rand; %0_2pi??????
ph2=2*pi*rand;
x=x+c1*cos(2*pi*(alpha*t+ph1)); % x-axis Gaussian process, power is 1
y=y+c2*cos(2*pi*(alpha*t+ph2)); % y-axis Gaussian process, power is 1
end
r=(x+sqrt(-1)*y)/sqrt(2); % normalized to the unit power, power is 1
% Rayleigh Fading process
rayleigh_fading_process = abs (r);
z=raylpdf(rayleigh_fading_process,0.5);
x2=raylrnd(0.5,1,100000);
y2=raylpdf(x2,0.5);
subplot(211)
plot(rayleigh_fading_process,z,'bO');
hold on;
plot(x2,y2,'r*');
legend('simulation','theory');
title('Probability Density For JAKES'); xlabel('rayleigh fading process'); ylabel('Probability');
N1=20000;
channelFFT = fft(r, N1);
channelPower = channelFFT.* conj(channelFFT) / N1;
subplot(212)
plot( linspace(-0.05, 0.05, N1), [channelPower(N1/2+1:N1), channelPower(1:N1/2)],'b');
title('Power Spectrum Density For JAKES'); xlabel('frequency (Hz)'); ylabel('Power');
Matlab模拟基于Jakes瑞利信道衰落仿真
版权申诉
199 浏览量
2022-06-17
11:45:27
上传
评论 1
收藏 31KB ZIP 举报
天天Matlab科研工作室
- 粉丝: 3w+
- 资源: 7258