Simulating rayleigh fading channel

11 visualizaciones (últimos 30 días)
Deep Patel
Deep Patel el 3 de Mzo. de 2018
Comentada: jian li el 28 de Mayo de 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 comentario
jian li
jian li el 28 de Mayo de 2020
Hello, I want to know what the picture from your program looks like?

Iniciar sesión para comentar.

Respuestas (1)

Trooper
Trooper el 3 de Mzo. de 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 comentario
Deep Patel
Deep Patel el 4 de Mzo. de 2018
I was creating empty arrays and storing values in it.
thanks for your reply

Iniciar sesión para comentar.

Categorías

Más información sobre Propagation and Channel Models en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by