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

📄 sa_ex6_5.m

📁 这个是英文版<<Smart Antennas for Wireless Communications>>配套的matlab源程序
💻 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 + -