📄 raydoppler.m
字号:
function [r]=ray_doppler(fm, M, dt, N)
% From: bbs.matwav.com
% Define variables:
% fm -- the maximum Doppler frequency in Hz
% M -- the number of sinusoids to generate the Rayleigh process, M > 16
% dt -- one symbol duration in second
% N -- the length of the fading sequence in symbol
T=N*dt-dt;
t=0:dt:T;
c=sqrt(2/M); % scaling factor of power
w=2*pi*fm; % maximum Doppler frequency in rad
x=0;
y=0;
for n=1:M
alpha=(2*pi*n-pi+(2*pi*rand-pi))/(4*M);
ph1=2*pi*rand-pi;
ph2=2*pi*rand-pi;
x=x+c*cos(w*t*cos(alpha)+ph1); % x-axis Gaussian process, power is 1
y=y+c*cos(w*t*sin(alpha)+ph2); % y-axis Gaussian process, power is 1
end
% generate a complex-valued sequence
% its amplitude is Rayleigh distributed
% its angle is uniformly distributed
r=(x+sqrt(-1)*y)/sqrt(2); % normalized to the unit power
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -