0

I have a current signal (extracted in csv) which I obtained from cadence simulation over 30ns time. I have removed DC offset and applied windowing function before FFT. And normalized FFT by sqrt(N). I have shift zero-frequency component to center of my desired spectrum with fftshift(X). I got my desired FFT. I also want to get back to my original windowed signal by ifft but it is not showing my windowed signal instead it is showing only a version of the window function that I used. My sample signal is real not complex.

I have another question. My power before FFT and after FFT is same. How can I show in graph in an intelligent way to show Parseval's theroem?

FFT and IFFT

I have also added my MATLAB code without the uploading csv and making the vectors. my y value is Current_wo_dc

MATLAB Code:

N = length(Current_wo_dc);
ts = 1.0e-12;
Fs = 1/ts;
tmax = (N-1)*ts;
tm = 0:ts:tmax;
f = -Fs/2:Fs/(N-1):Fs/2;

fn=hanning(N);  % hanning window function
Z = Current_wo_dc'.*fn; 

Power_Z = sum(Z.^2); % power in time domain

%FFT
fftY = fft(Z);
y = fftshift(fftY);
Y = abs(y);
a3 = Y/sqrt(N);

Power_fftY = sum(fftY.*conj(fftY))/length(fftY); % power in frequency domain

%IFFT:
I = ifftshift(fftshift(Z));
II = I*sqrt(N);

%PSD
psd = a3.^2;
psd_db = 10*log10(psd);

subplot(311), plot(Z); % windowed signal
subplot(312), plot(a3); % fft across frequency bin not shifted along frequency
subplot(313), plot(II); % ifft 
Harald K
  • 26,314
  • 7
  • 65
  • 111
aguntuk
  • 127
  • 9
  • As far as I can see in your code, you made a mistake. Where you mention the inverse Fourier transform, you are performing (`ifftshift(fftshift(Z))`), which doesn't change anything. You should instead define `I` as: `II = sqrt(N) * real(ifft(ifftshift(y)))` – Murad Omar Jun 27 '17 at 12:09
  • @MuradOmar, I tried your code but it is still the same. – aguntuk Jun 27 '17 at 22:51
  • 1
    what you can do, is may be try the code(any of them) on a simple textbook example, and see if you are getting what is expected, if not then there you can easily trace what went wrong. – Murad Omar Jun 28 '17 at 07:32
  • I don't quite understand what you are trying to do in `I = ifftshift(fftshit(Z))` Z being a time domain signal, what is the point of this? – GameOfThrows Jul 06 '17 at 12:31
  • Thanks. I solved it. actually my plotting name of 1st figure is somehow wrong and overlapped with the figure 2 & 3. – aguntuk Jul 10 '17 at 17:11

0 Answers0