matlab code
TRANSCRIPT
Matlab simulation: the program [3]
Matlab simulation: the program [3]
clear;
clc;
N=5000;
%Number of pathst=0.0001:10/N:10;
%Time rangefc=900*10.^6;
%Carrier frequencywc=2*pi*fc;
v=30/3600;
%Receiver speed[km/h]c=300*10^3;
%Light speedwm=wc*(v/c);
%Maximum shift
fm=wm/(2*pi);
%Doppler shiftfor i=1:N
A(i)=(2*pi/N)*i;
%Azimuthal angles wn(i)=wm*cos(A(i));
O(i)=(pi*i)/(N+1);
xc(i)=2*cos(wn(i)*t(i)).*cos(O(i))+cos(wm*t(i));
xs(i)=2*cos(wn(i)*t(i)).*sin(O(i));
T(i)=(1/(2*N+1)^0.5).*(xc(i)+j*xs(i));%Complex envelope end M=mean(abs(T));
%Mean MdB=20*log10(M);
TdB=floor(20*log10(abs(T)));
%Field [dB] z1=hist(abs(T));
z=hist(TdB,9);
n=0;
for k=1:9
n=n+z(k);
end for j=1:9
P(j)=z(j)/n;
end f(1)=P(1);
for x=2:9
f(x)=f(x-1)+P(x);
F(10-x)=f(x);
endplot(z1)
%Distribution charttitle('Rayleighs distribution');
pause
semilogy(t,abs(T)/max(abs(T)),'r') %Fading graphictitle('Received field');
ylabel('Received field intensity');
xlabel('time');
grid on
pause
loglog(100*F,'m');%Indicates the probability of exceed a given attenuationtitle('Probability of exceed a given attenuation (%)');Bosch, F 220976 Rev.:0002 Lang=Eng -2001