Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the second peak

Status
Not open for further replies.

Star1976

Materials
Joined
Jan 31, 2005
Messages
6
Location
GB
Hi
I am facing a trouble in locating the second maximum peak in FFT spectrum. I used the following to find the maximum peak but was not able to find the second peak..

X = abs(fft(Ei));
X = fftshift(X);
Peak = find(X == max(X));

Any help is appreciated !!!
 
Assuming you aren't looking for local maxima (i.e. the second highest local maxima), just sort X:

[Xs,idx]=sort(X);

Peak1 = idx(1)
Peak2 = idx(2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top