%dopplerspread.m
TAU0=0;
%beta is assumed as the one that is not varying with time
%nop is the number of paths
%txsignal is the transmitted signal
%rxsignal is the received signal
%tv_tf_comp_at_f is the time varying transfer function computed at the
%frequency f0
%TAUJ is the rate at which the delay is changing
%The f0 is in MHz and sampling time is in micro seconds
f0=1;
nop=4
BETA=rand(1,nop);
TAUJ=rand(1,nop)*2-1;
rxsignal=[];
tv_tf_comp_at_f=[];
t=0:(1/100):99.99;
txsignal=cos(2*pi*f*t);
z=1;
for t=0:(1/100):99.99
temp=0;
temp1=0;
for p=1:1:nop
temp=temp+BETA(p)*exp(j*2*pi*f0*t)*exp(-j*2*pi*f0*TAU0)*exp(-j*2*pi*f0*TAUJ(p)*t);
temp1=temp1+BETA(p)*exp(-j*2*pi*f0*TAU0)*exp(-j*2*pi*f0*TAUJ(p)*t);
end
rxsignal=[rxsignal temp];
tv_tf_comp_at_f=[tv_tf_comp_at_f temp1];
end
figure
subplot(2,2,1)
plot(txsignal)
subplot(2,2,2)
freqval=(0:1:length(rxsignal)-1)/100;
plot(real(rxsignal),'r')
subplot(2,2,3)
plot(freqval,abs(fft(txsignal)))
subplot(2,2,4)
plot(freqval,abs(fft(real(rxsignal))))
figure
subplot(2,1,1)
plot(abs(tv_tf_comp_at_f))
subplot(2,1,2)
plot(phase((tv_tf_comp_at_f)))
