Result Convolution/ multiplication in freq domain not the same
13 次查看(过去 30 天)
显示 更早的评论
Hi, I got a channel and I want to do a convolution with my Signal. I got a Test with multiplication in frequency domain - works fine. In time domain with convolution it doesn't work. My Signal is in real longer so i cant always use multiplication.
maybe you know the problem so I get the same signal with multiplication and convolution?
thank you!!
here i got my code:
I've seen that the fft result differs between row and column vector. Now I corrected to only row vectors, but no correct result... looks like impulse response wrong...
H_f = [0.0094 - 0.0373i, 0.0122 - 0.0326i, 0.0143 - 0.0279i, 0.0157 - 0.0247i];% channel spectrum
nSubcarriers = 4;
N = 64; % FFT
H_ifft = [0, H_f, zeros(1,N-2*length(H_f)-1), conj(H_f(end:-1:1))];
h_t = ifft(H_ifft, N); % impulse respone of channel
kk = 1e3;
data = (randn(1, 4*(kk+1)) >= 0);
iq_data_conv = [];
iq_data_freq = [];
for ii = 1:kk
Signal = 2*data(ii*4:(ii)*4+3) - 1;
TxSpectrum = [0, Signal, zeros(1,N-2*length(Signal)), conj(Signal(end:-1:1))];
ofdm_signal_t = ifft(TxSpectrum, N); % IFFT
%%%%%%%%%%%%%%%%%%%%%WITH CONVOLUTION
channel_signal_conv = conv(ofdm_signal_t, h_t);% CONV
channel_signal_conv = channel_signal_conv(1:length(ofdm_signal_t)); % cut
% ... noise ect
R_f = fft(channel_signal_conv, N); % FFT
s_rec = R_f(2:nSubcarriers+1);%Extracting the data carriers from the FFT output
iq_data_conv = [iq_data_conv s_rec];
%%%%%%%%%%%%%%%%%%%%%Multiplication in frequency domain
tmp = fft(ofdm_signal_t, N); % FFT
tmp = tmp(2:nSubcarriers+1);
tmpH = tmp.*H_f;
tmpC = [0, tmpH, 0, conj(tmpH(end:-1:1))];
channel_signal_freq = ifft(tmpC, N); % IFFT
% ... noise ect
R_f = fft(channel_signal_freq, N); % FFT
s_rec = R_f(2:nSubcarriers+1);%Extracting the data carriers from the FFT output
iq_data_freq = [iq_data_freq s_rec];
%%%%%%%%%%%%%%%%%%%%%
end
scatterplot(iq_data_conv);
scatterplot(iq_data_freq);
0 个评论
采纳的回答
更多回答(1 个)
Wayne King
2012-3-14
Without going into your code too much, since you are dealing with discrete Fourier transforms, you have to keep in mind that you must pad the data vectors in time before taking the DFT in order to demonstrate agreement with linear convolution.
For example, I'll filter a white noise input with a moving average filter.
h = 1/3*ones(3,1);
x = randn(16,1);
N = 16+3-1; %the minimum pad factor
h1 = [h; zeros(N-length(h),1)];
x1 = [x ; zeros(N-length(x),1)];
out = ifft(fft(x1).*fft(h1));
yconv = conv(x,h);
Compare out and yconv.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!