⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multipath_doppler.m

📁 对移动通信中的多径多普勒频移进行详细的仿真
💻 M
📖 第 1 页 / 共 2 页
字号:
f=10; % the frequency of the transmitted time harmonic signal
f_shift=f+shift;
t=[22:0.01:25];
%No Doppler shift
s_t=exp(j*2*pi*f*t); %transmitted signal
y_t=sum(a.*exp(-j*2*pi*f*tau))*exp(j*2*pi*f*t); %received signal
n=1;
y_d_t=sum(a(n)*exp(-j*2*pi*f*tau(n)))*exp(j*2*pi*(f_shift(n))*t);
for n=2:N
    y_d_t=y_d_t+a(n)*exp(-j*2*pi*f*tau(n))*exp(j*2*pi*(f_shift(n))*t); %received signal
end

figure (13)
subplot(2,2,3)
stem(f_shift,a)
xlabel('frequency, Hz')
ylabel('ray amplitude')
title('Doppler Shifts')

subplot(2,2,2)
plot(t,y_t,'r')
title('no Doppler shift')
ylabel('received signal')
xlabel('time, sec')

subplot(2,2,1)
stem(tau,a)
xlabel('Time, Sec')
ylabel('ray amplitude')
title('Time Delay')

subplot(2,2,4)
plot(t,y_d_t)
title('with Doppler shifts')
ylabel('received signal')
xlabel('time, sec')
%==============================================================


%==============================================================
% The variation rate (with respect to time) of the envelope of the time varying signal is
% proportional to the Doppler spread. A larger Doppler spread causes a faster variation in
% the envelope of the time varying signal. This is illustrated by Figure 14 where the
% envelope of the time varying signal for four Doppler spreads is plotted against the time.
% The code of generating this figure is also shown below. For the case with Doppler
% spread=0.01Hz, a cycle of variation (from a local peak to the next local peak) is of the
% order of 100 sec. Similarly, for the case with delay spread=0.05 Hz, 0.1 Hz, or 0.5 Hz, a
% cycle of variation (from a local peak to the next local peak) is of the order of 20 sec, 10
% sec, or 2 sec, respectively.
% ---------------------      figure 14      ---------------------%
clear all;
N=20 ;% number of multipath arrivals
a=rand(1,N); %amplitude
tau=rand(1,N); %arrival time
f_d=0.01;     %delay spread
shift=rand(1,N)*2*f_d-f_d; %Doppler shifts
f=10; % the frequency of the transmitted time harmonic signal
f_shift=f+shift;
t=[0:0.01:50];
n=1;
y_d_t=sum(a(n)*exp(-j*2*pi*f*tau(n)))*exp(j*2*pi*(f_shift(n))*t);
for n=2:N
    y_d_t=y_d_t+a(n)*exp(-j*2*pi*f*tau(n))*exp(j*2*pi*(f_shift(n))*t); %received signal
end
figure (14)
subplot(2,2,1)
plot(t,y_d_t)
xlabel('time, sec')
ylabel('f_D=0.01')
N=20 ;% number of multipath arrivals
a=rand(1,N); %amplitude
tau=rand(1,N); %arrival time
f_d=0.05;            %delay spread
shift=rand(1,N)*2*f_d-f_d; %Doppler shifts
f=10; % the frequency of the transmitted time harmonic signal
f_shift=f+shift;
t=[0:0.01:50];
n=1;
y_d_t=sum(a(n)*exp(-j*2*pi*f*tau(n)))*exp(j*2*pi*(f_shift(n))*t);
for n=2:N
    y_d_t=y_d_t+a(n)*exp(-j*2*pi*f*tau(n))*exp(j*2*pi*(f_shift(n))*t); %received signal
end

subplot(2,2,2)
plot(t,y_d_t)
xlabel('time, sec')
ylabel('f_D=0.05')
N=20 ;% number of multipath arrivals
a=rand(1,N); %amplitude
tau=rand(1,N); %arrival time
f_d=0.1;         %delay spread
shift=rand(1,N)*2*f_d-f_d; %Doppler shifts
f=10; % the frequency of the transmitted time harmonic signal
f_shift=f+shift;
t=[0:0.01:50];
n=1;
y_d_t=sum(a(n)*exp(-j*2*pi*f*tau(n)))*exp(j*2*pi*(f_shift(n))*t);
for n=2:N
    y_d_t=y_d_t+a(n)*exp(-j*2*pi*f*tau(n))*exp(j*2*pi*(f_shift(n))*t); %received signal
end
subplot(2,2,3)
plot(t,y_d_t)
xlabel('time, sec')
ylabel('f_D=0.1')
N=20 ;% number of multipath arrivals
a=rand(1,N); %amplitude
tau=rand(1,N); %arrival time
f_d=0.5;     %delay spread
shift=rand(1,N)*2*f_d-f_d; %Doppler shifts
f=10; % the frequency of the transmitted time harmonic signal
f_shift=f+shift;
t=[0:0.01:50];
n=1;
y_d_t=sum(a(n)*exp(-j*2*pi*f*tau(n)))*exp(j*2*pi*(f_shift(n))*t);
for n=2:N
    y_d_t=y_d_t+a(n)*exp(-j*2*pi*f*tau(n))*exp(j*2*pi*(f_shift(n))*t); %received signal
end
subplot(2,2,4)
plot(t,y_d_t)
xlabel('time, sec')
ylabel('f_D=0.5')
%==============================================================



%=========================================================
% Here, we artificially make all travel time delays zero ( n τ =0). Consider s(t) is 1 between t0
% to t0+5μs and is zero elsewhere. Plot y(t) for two observation times t0=0sec and 20msec
% in Figure 15. We observe that, at first, there is no distortion at the receiver because all
% travel time delays are zero ( n τ =0). Secondly, Doppler spread causes the signal to vary
% with time. At different observation times, the received signals are different. Thirdly, a
% larger Doppler spread causes a faster time variation rate.
% ---------------------      figure 15      ---------------------%
clear;
t=(0:0.01:10);an=[1,0.3,-0.8,0.5,-0.4,0.2];wn=[0,2,10,6,8,4];
for i=1:6;
    s1(i,:)=an(i)*exp(j*0*wn(i))*[ones(1,501),zeros(1,500)];
    s2(i,:)=an(i)*exp(j*0.02*wn(i))*[ones(1,501),zeros(1,500)];
end
y1(1,:)=sum(s1);y2(1,:)=sum(s2);wn1=[0,20,100,60,80,40];
for k=1:6;
    s3(k,:)=an(k)*exp(j*0*wn1(k))*[ones(1,501),zeros(1,500)];
    s4(k,:)=an(k)*exp(j*0.02*wn1(k))*[ones(1,501),zeros(1,500)];
end
y3(1,:)=sum(s3);y4(1,:)=sum(s4);

figure (15)
subplot(2,1,1);
plot(t,abs(y1));ylabel('y(t)'); xlabel('Time(us)');
title('case 1: small Doppler spread')
ylim([-0.2 2.2]);hold on;
plot(t,abs(y2),'r');hold off
legend('t_0=0msec','t_0=20msec')

subplot(2,1,2);
plot(t,abs(y3));xlabel('Time(us)');ylabel('y(t)');
title('case 2: large Doppler spread')
ylim([-0.2 2.2]);hold on;
plot(t,abs(y4) ,'r');hold off
legend('t_0=0msec','t_0=20msec')
%============================================================


%============================================================
% We will discuss the frequency-domain view first.
% Figure 16: The larger delay spread causes faster variation rate with respective to
% frequency (cases 1 & 2). The larger Doppler spread causes faster variation rate with
% respective to the observation time (cases 2 &4). Legend: red (blue) line represents the
% observation made at t0=20msec (0msec).
% ---------------------      figure 16      ---------------------%
clear;
an=[1,0.3,-0.8,0.5,-0.4,0.2];
tn=[0,1,2,3,4,5;0,1,2,3,4,5;0,0.1,0.2,0.3,0.4,0.5;0,0.1,0.2,0.3,0.4,0.5];
wn=[0,2,10,6,8,4;0,20,100,60,80,40;0,2,10,6,8,4;0,20,100,60,80,40];
f=-1:0.01:1;
w=2*pi*f;
for k=1:4;
    for i=1:6;
        h1(i,:)=an(i)*exp(-j*w*tn(k,i))*exp(j*wn(k,i)*0);
        h2(i,:)=an(i)*exp(-j*w*tn(k,i))*exp(j*wn(k,i)*0.02);
    end
    h1_1(k,:)=sum(h1(:,1:end));
    h1_2(k,:)=sum(h2(:,1:end));
end

figure (16)
subplot(4,2,1);plot(f,abs(h1_1(1,:)));ylabel('case 1');ylim([0 4]);
hold on
plot(f,abs(h1_2(1,:)) ,'r');title('amplitude');
%legend('t_0=0msec','t_0=20msec')
hold off

subplot(4,2,2);plot(f,angle(h1_1(1,:))); ylim([-4 4]);
hold on
plot(f,angle(h1_2(1,:)) ,'r'); title('phase'); %
hold off
subplot(4,2,3);plot(f,abs(h1_1(2,:)));ylabel('case 2');ylim([0 4]);
hold on
plot(f,abs(h1_2(2,:)) ,'r');
hold off
subplot(4,2,4);plot(f,angle(h1_1(2,:)));ylim([-4 4]);
hold on
plot(f,angle(h1_2(2,:)) ,'r');
hold off

subplot(4,2,5);plot(f,abs(h1_1(3,:)));;ylabel('case 3');ylim([0 4]);
hold on
plot(f,abs(h1_2(3,:)) ,'r');
hold off
subplot(4,2,6);plot(f,angle(h1_1(3,:))); ylim([-4 4]);
hold on
plot(f,angle(h1_2(3,:)) ,'r');
hold off
subplot(4,2,7);plot(f,abs(h1_1(4,:)));xlabel('Frequency(MHz)');
ylabel('case 4');ylim([0 4]);
hold on
plot(f,abs(h1_2(4,:)) ,'r');
hold off
subplot(4,2,8);plot(f,angle(h1_1(4,:)));xlabel('Frequency(MHz)');
ylim([-4 4]);
hold on
plot(f,angle(h1_2(4,:)) ,'r');
hold off;
% ================================================================


% ================================================================
% Now we will discuss the time-domain view.
% The larger delay spread causes more distortion (cases 1 & 2). The larger
% Doppler spread causes faster variation rate with respective to the observation time (cases
% 2 &4). Legend: red (blue) line represents the observation made at t0=20msec (0msec).
% ---------------------      figure 17      ---------------------%
clear all;
an=[1,0.3,-0.8,0.5,-0.4,0.2];
tn=[0,1,2,3,4,5;0,1,2,3,4,5;0,0.1,0.2,0.3,0.4,0.5;0,0.1,0.2,0.3,0.4,0.5];
wn=[0,2,10,6,8,4;0,20,100,60,80,40;0,2,10,6,8,4;0,20,100,60,80,40];
for k=1:4;
    for i=1:6;
        s1(i,:)=an(i)*exp(j*0*wn(k,i))*[zeros(1,(100*tn(k,i))),ones(1,501),zeros(1,(1000-100*tn(k,i)))];
        s2(i,:)=an(i)*exp(j*0.02*wn(k,i))*[zeros(1,(100*tn(k,i))),ones(1,501),zeros(1,(1000-100*tn(k,i)))];
    end
    y1(k,:)=sum(s1(:,1:end));
    y2(k,:)=sum(s2(:,1:end));
end
t=((1:1:length(y1(1,:)))-1)*10^(-2);

figure (17)
subplot(4,2,1);plot(t,real(y1(1,:)));ylabel('case 1');ylim([-2 2]);
hold on
plot(t,real(y2(1,:)),'r');title('real part')
hold off

subplot(4,2,2);plot(t,imag(y1(1,:)));ylim([-2 2]);
hold on
plot(t,imag(y2(1,:)),'r');title('imaginary part')
hold off

subplot(4,2,3);plot(t,real(y1(2,:)));ylabel('case 2');ylim([-2 2]);
hold on
plot(t,real(y2(2,:)),'r');
hold off

subplot(4,2,4);plot(t,imag(y1(2,:)));ylim([-2 2]);
hold on
plot(t,imag(y2(2,:)),'r');
hold off

subplot(4,2,5);plot(t,real(y1(3,:)));;ylabel('case 3');ylim([-2 2]);
hold on
plot(t,real(y2(3,:)),'r');
hold off

subplot(4,2,6);plot(t,imag(y1(3,:)));ylim([-2 2]);
hold on
plot(t,imag(y2(3,:)),'r');
hold off

subplot(4,2,7);plot(t,real(y1(4,:)));xlabel('Time(us)');ylabel('case 4');
hold on
plot(t,real(y2(4,:)),'r');ylim([-2 2]);
hold off

subplot(4,2,8);plot(t,imag(y1(4,:)));xlabel('Time(us)');ylim([-2 2]);
hold on
plot(t,imag(y2(4,:)),'r');
% ================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -