function [h,Nfft,Nifft,doppler_coeff]=FWGN_model(fm,fs,N)
% FWGN(Clarke/Gan) Model
% Input
% fm= Maximum Doppler frquency 最大多普勒频率
% fs= Sampling frequency 采样频率
% N = Number of samples 采样数
% Output
% h = Complex fading channel 复信道衰落
% Make them simple by taking a FFT with some 2^n points. 为了简单,FFT的大小应为2^n
% tone spacing df=2fm/Nfft 载波间隔
Nfft = 2^max(3,nextpow2(2*fm/fs*N)); % Nfft=2^n
Nifft = ceil(Nfft*fs/(2*fm));
% Generate the inependent complex gaussian random process. 产生独立复高斯随机过程
GI = randn(1,Nfft); GQ = randn(1,Nfft);
% take FFT of real signal in order to make hermitian symmetric
% 为了实现诶米特对称,对信号取FFT
CGI = fft(GI); CGQ = fft(GQ);
% Nfft sample Doppler spectrum generation 生成Nfft个多普勒的采样值
doppler_coeff = Doppler_spectrum(fm,Nfft);
% Do the filtering of the gaussian random variables here. 对得到的高斯随机变量滤波
f_CGI = CGI.*sqrt(doppler_coeff);
f_CGQ = CGQ.*sqrt(doppler_coeff);
% adjusting sample size to take IFFT by (Nifft-Nfft) sample zero-padding
% 为了实现IFFT,通过(Nifft-Nfft)个采样补零来调整采样尺寸
tzeros= zeros(1,Nifft-Nfft);
Filtered_CGI=[f_CGI(1:Nfft/2) tzeros f_CGI(Nfft/2+1:Nfft)];
Filtered_CGQ=[f_CGQ(1:Nfft/2) tzeros f_CGQ(Nfft/2+1:Nfft)];
hI = ifft(Filtered_CGI);
hQ= ifft(Filtered_CGQ);
% Take the magnitude squared of the I and Q components and add them
% together. 求出I路和Q撸分量幅度的平方,然后将其相加
rayEnvelope = sqrt(abs(hI).^2 + abs(hQ).^2);
% Compute the Root Mean Squared Value and Normalize the
% envelope.计算均方根值,归一化包络
rayRMS = sqrt(mean(rayEnvelope(1:N).*rayEnvelope(1:N)));
h = complex(real(hI(1:N)),-real(hQ(1:N)))/rayRMS;
评论0