Getting strange results for convolution with DFT.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I am trying to determine input with a division of output and impulse response in Fourier domain of a linear system. A minimum regeneration example is below,
Output and impulse are two Guassians with different widths.
Output = y, Fourier Y
Impulse = h, Fourier H
For linear systems y = conv(h,x) or in Fourier domain Y = H*X
I am determining input as x = inverse_fourier(Y/H).
I am getting strange curves, depending on the sampling and scaling. Not sure what I am doing wrong? Many thanks in anticipation.
x = -50:0.1:50;
b1 = 2;
b2 = 40;
sig_1 = exp(-(x./b1).^2); % impulse
sig_2 = exp(-(x./b2).^2); % output
figure
plot(x,sig_1);
hold on
plot(x,sig_2);
step_num = size(x,2);
% frequency scale
w_k = (0:step_num-1) * (2*pi/step_num);
w_k = fftshift(w_k);
w_k = unwrap(w_k - 2*pi);
% signal 1
sig1_f = fft(sig_1,step_num);
sig1_f = fftshift(sig1_f);
h0 = figure; % fourier spectrum
plot(w_k,abs(sig1_f),'-*')
hold on
% signal 2
sig2_f = fft(sig_2,step_num);
sig2_f = fftshift(sig2_f);
plot(w_k,abs(sig2_f),'-*k')
input_f = (sig2_f)./(sig1_f);
% truncating higher freq
input_f(sig1_f<0.1) = 0;
plot(w_k,abs(input_f),'-*g')
input1 = ifft(input_f);
input1 = ifftshift(input1);
figure % input
plot(x,abs(input1),'*-k')
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Discrete Fourier and Cosine Transforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!