Where is the error in the code using "rayleighchan" function?
11 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I want to use "rayleighchan" function to simulate frequency selective fading channel. I also want to use OFDM technique to mitigate ISI. Now, I'm just trying to mitigate multipath delay caused by rayleighchan function as specified in Matlab Help (Using fading channels, working with delays section) on a very basic code, but my received signal is very different. Channel delay is 4 but received signal is not delayed by 4. Other datas in received signal is received wrong. Could you please help me on this topic?
clc;
clear all;
ts = 1/16; % sample time of the input signal (in seconds)
fd = 0; % maximum Doppler shift (in Hz)
tau = [0 1/160 1/260]; % vector of path delays (in seconds)
pdb = [0 -8 -17]; % average path gains (in dB)
%Rayleigh Fading Channel
chan = rayleighchan (ts,fd,tau,pdb);
delay = chan.ChannelFilterDelay;
% Data to be transmitted
data = [0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
% DPSK Modulation
moda = dpskmod(data,2);
% IFFT Operation
moda_fft = (16/sqrt(16))*ifft(fftshift(moda.')).';
% Channel effect + AWGN
xt = zeros(1,16);
xt = filter(chan,moda_fft);
awgn_moda = awgn(xt,12);
%FFT and Demodulation
demoda_fft =(sqrt(16)/16)*fftshift(fft(awgn_moda.')).';
demoda = dpskdemod(demoda_fft,2);
% Truncating channel delay with DPSK initial condition together
demoda = demoda(delay+1:end)
data_out = data(1:end-delay)
%Error calculation
sum_error = sum(sum(data_out~=demoda))
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Propagation and Channel Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!