Simulating rayleigh fading channel

5 vues (au cours des 30 derniers jours)
Deep Patel
Deep Patel le 3 Mar 2018
Commenté : jian li le 28 Mai 2020
Hi, I am simulating a rayleigh fading channel. I am getting a "Subscripted assignment dimension mismatch" on line 31. I am trying to sample for 1000 samples.
Any help would be appreciated for the error.
Thanks,
if true
%Initial conditions
N = 16; %Scatters
fc = 2000000000; %Carrier frequency of wave
v = 27.78; %Velocity of wave in km/h
c = 300000000; %Speed of light
Cn = 1/sqrt(N);
E0 = 1;
Tc = 0;
Ts = 0;
T = 0:250;
tc = zeros(1002,1);
ts = zeros(1002,1);
for t = 1:length(T) %Simulate Rayleigh channel for 250 ms
for a = 1:1001
for n = 1:N %Simulate Rayleigh channel for 16 scattering paths
lambda = c/fc; %Wavelength
alphan = (2*pi*n)/N; %Doppler shift angle
fn = (v/lambda)*cos(alphan); %Doppler frequency
phin = 2*pi*rand(1); %Random phase on each scatter path
TC = Cn*cos(2*pi*fn*t + phin);
Tc = Tc + TC;
TS = Cn*sin(2*pi*fn*t + phin);
Ts = Ts + TS;
end
tc(a) = Tc;
ts(a) = Ts;
end
Ez(t) = abs(sqrt(tc.*tc + ts.*ts));
Ez_dB(t) = 20*log(Ez(t));
end
figure %Plotting power gain of envelope plot(T,Ez_dB),grid on; title(' Rayleigh Fading Channel over Time'); xlabel(' Time (ms) '); ylabel(' Power Gain (dB) ');
figure %Plotting envelope histogram hist(abs(Ez),20); title(' Rayleigh Fading Channel Envelope'); xlabel(' Envelope of E field '); ylabel(' Number of Times '); end
  1 commentaire
jian li
jian li le 28 Mai 2020
Hello, I want to know what the picture from your program looks like?

Connectez-vous pour commenter.

Réponses (1)

Trooper
Trooper le 3 Mar 2018
Remove '(t)' from Ez(t) = abs(sqrt(tc.*tc + ts.*ts)); it will work then. Also what are you trying to do at
tc = zeros(1002,1); ts = zeros(1002,1); and tc(a) = Tc; ts(a) = Ts;
  1 commentaire
Deep Patel
Deep Patel le 4 Mar 2018
I was creating empty arrays and storing values in it.
thanks for your reply

Connectez-vous pour commenter.

Catégories

En savoir plus sur Propagation and Channel Models dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by