?? multipath_1.m
字號:
%Simple two path Rayleigh fading channel
%Push F5 to run
%JC-3/27/06
%I would put this under WIRELESS TIPS AND TRICKS AS MULTIPATH. YOU PICK
%YOUR POISON FOR VARIABLES YOU WANT TO USE.
%This m-file uses successive iterations of data to create an animated effect
%showing the results of passing an unmodulated carrier through a simple two
%path Rayleigh fading channel. The following formula and diagram
%illustrates the m-file operation. The animation shows, input(blue)
%and the output(red), the the phase shifts, gains, and attenuations
%of the output sine wave or carrier.
% L
%r(t)=sum ak(t)*s(t-tauk)
% k
% !------------------Fixed gain-------!
% ! !
%s(t)--!signal in Sum--------r(t)signal out
% ! !
% !---------Delay----Variable gain----!
% or attenuation
clear
f_c=1e3;%carrier frequency(no modulation)
time_1 = (linspace (0, 10, 1000));%time
signal_in = sin (2 * pi *f_c* time_1);%sine wave
plot (time_1, signal_in, 'b');grid on;%blue=signal_in
xlabel('time');ylabel('amplitude');
title('Rayleigh fading channel with two path sine wave input')
hold on
for ii = 1:10%# iterations
tau=round(50*rand(1,1)+1);% variable delay(phase shift)
g1=1;%fixed gain
g2=round(.5*rand(1,1)+1);%variable gain or attenuation
signal_out=g1*signal_in + g2*[zeros(1,tau) signal_in(1:end-tau)];
plot (time_1,(signal_out),'r')%red=signal_out
pause (2)%~ seconds
end
hold off
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -