0
$\begingroup$

I want to convert given signal into frequency domain and do some calculation and then convert that signal into time domain. Here is the code which I am trying out

Fs = 100;             % Sampling frequency
T = 1/Fs;             % Sampling period
L = 1000;             % Length of signal
t =  0:0.001:1;       % Time vector
fc = 24;              %cut-off frequency
Wn = (2/Fs)*fc;       % normalized value of fc

s = sin(2*pi*(Fs/2)*t);
x = s;

y = fft(x);
figure;plot(t,y);
b = fir1(10,Wn,'low');
fvtool(b,1,'Fs',Fs)
y = filter(b,1,y);
figure;plot(t,y);
new_x = abs(ifft(y));
figure;plot(t,new_x);

Without applying low pass filter can get original signal by using ifft. But after applying low pass filter can't able to recreate original signal. Can someone let me explain where went wrong?

$\endgroup$
  • $\begingroup$ you seem to have problems with continuous signals, discrete signals, sampling and their Matlab simulations... $\endgroup$ – Fat32 Mar 7 '17 at 14:01
1
$\begingroup$

Part of them problem at least appears to be your use of the filter() function. Applying this function in the frequency domain is not the same as applying it in the time domain.

In the time-domain the function performs the role of a typical digital filter, with recursive and non-recursive coefficients. When there are no recursive coefficients (as in your case) it is effectively convolving the filter coefficients with its input signal.

Convolving the time-domain signal with these filter coefficients will return a very different value to convolving them with the frequency-domain signal.

If you want to perform an equivalent filtering operation in the frequency domain you instead need to transform your filter coefficients, and them multiply them with the output of the FFT.

Convolution in the time-domain becomes multiplication in the frequency domain.

Look up the convolution theorem or frequency domain filtering if you'd like to find out more.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.