Is it possible to reconstruct the signal wave after you done the whole fft function by using the ifft?
Show older comments
Hello everyone.
So I was doing the FFT for some signal I have and I confident about the fft result I got. However, I somehow want to filter some unimportantt frequency range and reconstruct the signal through the double side fft (fftshift) result and I encountered some problems that I feel I cannot solve.
My first step for my double side fft result is just set the range of data as 0. Then I start to use the ifftshift to make my edited double side fft to be a fft result. Then I used the ifft to form the raw time/magnitude function. However, the outcome of ifft is not good. Since the fftshift part I already used the abs value to present the result, when I went back I am not considering the imaginary part and thus my final outcome is way off the original sgnal.
I want to ask is anyone know how to counter the imaginary part and able to reconstruct the original signal with the fftshift result (after absolute)? I really appriciate any recommendination!
% EDIT: loading your data so that your example can be run
data = readmatrix('Data11.xlsx');
T1 = data(:,1);
I1 = data(:,2);
% In here I name the current value as I1 and time as T1.
Fs = 1*10^10;
y = fft(I1);
L = length(y);
z = (fftshift(y))/(L/2); % divide L/2 to get the magnitude I want
abz = abs(z);
ly = L;
f_1 = (-ly/2:ly/2-1)/ly*Fs;
figure(1)
plot(f_1,abz)
xlim([0 5*10^7])
grid
% Now I am finding the range I want to make it 0. (from -5*10^9 to -3*10^7
% and 3*10^7 to 5*10^9).
dif_f = f_1(2)-f_1(1);
location_1 = round((-3*10^7-(-5*10^9))/dif_f);
location_2 = ly - location_1;
abz([1:location_1]) = 0;
abz([location_2:end]) = 0;
new_abz = abz*(L/2); % Times L/2 back to reconstruct the signal
new_fftshift = ifftshift(new_abz);
new_graph = ifft(new_fftshift);
figure(2)
plot(T1,new_graph) %So it looks really diff than the original signal...
1 Comment
Paul
on 25 Apr 2023
Hi Hantao,
Haven't had a chance to look at the problem in detail yet.
Why take the absolute value of z? Once you do that you lose all of the phase information and it will be highly unlikely that going the other way using ifft will yield anything useful. Have you tried something like this:
ifft(abs(fft(y)))
and comparing that result to y just to see the effect of taking the absolute value?
Accepted Answer
More Answers (0)
Categories
Find more on Bartlett in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



