How to design baseband filter for OFDM?

조회 수: 5 (최근 30일)
Mursid Abidiarso
Mursid Abidiarso 2016년 12월 1일
답변: Madhumitha Munusamy 2019년 9월 23일
I design OFDM, after i add CP, i want to give pulse shaping, or window filter (like hamming, hanning, blackman), but the output seems wrong, the main lobe attenuate as sidelobe. I know my ofdm is baseband signal, and i think it's ok with my code. What i want to ask is, whats wrong with my filter design? how to fix it? Is it same with pulse shaping with rcosine? Thank you
Please help me, i have done 2 weeks reseach on internet and matwork code, i dont really know how to do next.
Here's the part that is wrong. Even i use fvtool(filt_hamm), i think freq response of filter is true, the output must be true, but actually no, I know it's wrong when i find its BER (and its PSD is not good), and really bad compare without filtering, it must be wrong.
filt_hamm=fir1(4095,n_subcarrier/n_fft,hamming(4096)); %cut off at n_subcarrier/n_fft
for y=1:1:n_simbol
Tx_OFDM_filt_hamm(y,:)=filter(filt_hamm,1,Tx_OFDM_cp(y,:));
end
This is my code, it's working except the filter
clc; clear all; close all;
%%Parameter OFDM
n_subcarrier=1000; % Number of subcarrier
n_simbol=100; % Number of symbol
n_fft=4096; % Size FFT/IFFT
M=16; % Constellation Order
Tipe=2; % Modulate type, 1=PSK, 2=QAM
Phase_Offset=0;
N=4 ; % percentage of cyclic prefix n_fft/N
%%Transmitter
if Tipe == 1
Tx = modem.pskmod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray','InputType','bit');
Rx = modem.pskdemod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray','OutputType','bit');
else
Norm_mod=sqrt(3/2/(M-1));
Tx = modem.qammod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray','InputType','bit');
Rx = modem.qamdemod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray','OutputType','bit');
end
Tx_data=double(rand(n_subcarrier*log2(M),n_simbol)<.5);% Generate bitsream
Tx_modulated=Norm_mod*modulate(Tx,Tx_data); % Modulating
Tx_Zpad = [Tx_modulated(n_subcarrier/2+1:end,:);... % Add Zero Padding at the center
zeros(n_fft-n_subcarrier,n_simbol);...
Tx_modulated(1:n_subcarrier/2,:)];
Tx_OFDM=ifft(Tx_Zpad,n_fft); % IFFT
Tx_p2s=Tx_OFDM.'; % Parallel to serial
CP_part=Tx_p2s(:,end-(n_fft/N)+1:end); % Part Of CP
Tx_OFDM_cp=[CP_part Tx_p2s]; % Add CP to OFDM
filt_hamm=fir1(4095,n_subcarrier/n_fft,hamming(4096)); %cut off at n_subcarrier/n_fft
for y=1:1:n_simbol
Tx_OFDM_filt_hamm(y,:)=filter(filt_hamm,1,Tx_OFDM_cp(y,:));
end
Channel + Receiver
n_tap=4096; %
h_rayleigh=(randn(n_simbol,n_tap)+1i*randn(n_simbol,n_tap)).*sqrt(1/2);
h_ray_freq=fft(h_rayleigh,length(Tx_OFDM_cp),2); % channel impulse response
Tx_OFDM_rayleigh=Tx_OFDM_cp.*h_ray_freq;
SNR_awal=-10; SNR_tambah=2;SNR_akhir=30;const=0; % Awal means start (first iteration)
r=zeros(size(SNR_awal:SNR_tambah:SNR_akhir)); % tambah means increament
for snr=SNR_awal:SNR_tambah:SNR_akhir % akhir means end (last interation)
const=const+1;
Rx_AWGN=awgn(Tx_OFDM_rayleigh,snr,'measured'); % Noise AWGN
Rx_equalization=Rx_AWGN./h_ray_freq; % ideal equalization
Rx_OFDM_cp_remove=Rx_equalization(:,(n_fft/N)+1:n_fft+(n_fft/N)); % release Cyclic prefix
Rx_s2p=Rx_OFDM_cp_remove.'; % Serial to parallel
Rx_deOFDM=fft(Rx_s2p,n_fft) ; % FFT
Rx_Zpad= [Rx_deOFDM(n_fft-n_subcarrier/2+1:n_fft,:);... % release Zero Padding
Rx_deOFDM(1:n_subcarrier/2,:)];
Rx_demodulation=demodulate(Rx,Rx_Zpad./Norm_mod); % Demodulation
[n, r(1,const)]=biterr(Tx_data,Rx_demodulation); % Calculate BER
end
%%Graph
snr=SNR_awal:SNR_tambah:SNR_akhir;
% Plotting BER vs SNR
figure(1);
if M==2
semilogy(snr,r(1,:),'-ok','DisplayName','OFDM 2QAM');
elseif M==4
semilogy(snr,r(1,:),'-om','DisplayName','OFDM 4QAM');
elseif M==8
semilogy(snr,r(1,:),'-oc','DisplayName','OFDM 8QAM');
elseif M==16
semilogy(snr,r(1,:),'-ob','DisplayName','OFDM 16QAM');
elseif M==32
semilogy(snr,r(1,:),'-og','DisplayName','OFDM 32QAM');
elseif M==64
semilogy(snr,r(1,:),'-or','DisplayName','OFDM 64QAM');
end
hold on
grid on;
title('OFDM Bit Error Rate vs SNR');
ylabel('Bit Error Rate');
xlabel('SNR [dB]');
legend('show')
figure(2);
hold on
[Pxx1,W1]=pwelch(Tx_OFDM_cp(1,:),[],[],[],'centered','psd');
[Pxx3,W3]=pwelch(Tx_OFDM_filt_hamm(1,:),[],[],[],'centered','psd');
plot(W1,10*log10(Pxx1/max(Pxx1)),'DisplayName','OFDM');
plot(W3,10*log10(Pxx3/max(Pxx3)),'DisplayName','OFDM hamming'); hold on
grid on
xlim([-pi,pi])
set(gca,'xtick',[-pi,-pi/2,0,pi/2,pi])
set(gca,'xticklabel',{' -\pi';'-0.5\pi';' 0';' 0.5\pi';' \pi'})
xlabel('Normalize Frequency (radian/sampel)')
ylabel('Power spectral density (PSD)')
title('OFDM');
legend('show')
  댓글 수: 1
Rishabh Rawat
Rishabh Rawat 2019년 1월 4일
Hi,
Any solution to this query? I am having the same doubt.

댓글을 달려면 로그인하십시오.

답변 (1개)

Madhumitha Munusamy
Madhumitha Munusamy 2019년 9월 23일
i am having a little problem over here. can someone help me
i have a OFDM matlab code. In that i want to replace cyclic prefix by NPR filter to analyze the performance but it's showing error.

카테고리

Help CenterFile Exchange에서 Test and Measurement에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by