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