# How to get back the peak to peak signal level from the fft data?

#### sharath_412

Joined May 7, 2007
32
Hi,
This calculations are done in matlab.

1. Generate sine wave with some frequency and amplitude.
2. Calculate the fft using fft function. We get the frequency spectrum.
3. How to get back the peak to peak level of the input signal.

What my senior has done is

He found the peak value in the fft. let that peak value be fft(p).

Then the peak to peak input signal level= sum( fft(p-1):fft(p+1))*2*sqrt(2);

Can anyone explain this to me.

The code is
clc;
t=0:.0001:0.242; x=sin(2*pi*100*t);
l=length(x);
y=abs(fft(x))/l;
[p,m]=max(y);
Vpp=sum(y((m-1) m+1)))*2*sqrt(2); % this is what i did not understand.
disp(Vpp);
subplot(2,1,1);plot(t,x);
subplot(2,1,2);plot(abs(y));

---END OF PROGRAM--

% let t be the sampling period( in real applications we will not receive 360 degrees waveform at the end as you can see the plot of x) )

% 100 is the input frequency
% l = number of samples of x
% abs= absolute value

% If suppose y=[1 2 3 5 8 4 3 2 1] then p=8 and m=5 after this statement

#### Dave

Joined Nov 17, 2003
6,969
I too am as confused as you.

If I am reading your question right, you are interogating the output of the FFT to ascertain the Vpp of the original sine signal - Right?

If so, Vpp = 2V from both the expression for x = sin(2*pi*100*t) and from the plot of x against t, not 1.884V as derived from the above code.

Usually, analysis of the FFT data is for the purposes of extracting information about the power spectrum - could this be where the 2(root(2)) comes in?

I think you may not be interpreting the functionality of the code and would advise that (if possible) you go cap-in-hand to the author and ask them.

Dave