?? sa_ex6_5.m
字號:
% Fast fading with velocity Example 6.5
N = 100; % number of scatterers
a=randn(N,1); % create Gaussian amplitude coefficients
%a=a/max(a); % no coefficent can be larger than 1
th=rand(N,1)*2*pi; % create uniform phase angles
ph=rand(N,1)*2*pi;
%ph=[zeros(N,1)];
fd=149; % Doppler
%fd=250;
tmax = 10/fd; % Maximum time
omega=2*pi*fd;
t=[0:999]*tmax/999; % generate timeline
Fs=length(t)/tmax;
X=[zeros(1,length(t))];
Y=[zeros(1,length(t))];
for n=1:N % generate the sums for X and Y
X=X+a(n)*cos(omega*cos(th(n))*t+ph(n));
Y=Y+a(n)*sin(omega*cos(th(n))*t+ph(n));
end
r=sqrt(X.^2+Y.^2); % Calculate the Rayleigh envelope
rdb=20*log10(r); % Calculate the envelope in dB
figure;
plot(t*1000,rdb,'k') % plot
xlabel('time (ms)')
ylabel('envelope')
axis([0 65 -30 10])
X=[X zeros(1,2*length(X))];
Xf=fft(X);
Xf=fftshift(Xf);
NXf=length(Xf);
f=[-NXf/2+1:NXf/2]*Fs/(NXf);
figure;
plot(f,abs(Xf)/max(abs(Xf)),'k');
axis([ -Fs/40 Fs/40 0 1.2])
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -