help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding peaks/max in a graph


From: Joe Koski
Subject: Re: Finding peaks/max in a graph
Date: Mon, 05 Apr 2004 09:56:49 -0600
User-agent: Microsoft-Entourage/10.1.4.030702.0

on 4/5/04 9:22 AM, edA-qa mort-ora-y at address@hidden wrote:

> David Bateman wrote:
>> A for-loop is not the way to go about this. Consider the code fragment
>> n = 9
>> a = [1 2 3 4 5 4 3 2 1]';
>> peaks = find([a(2:n,1) - a(1:n-1,1) < 0; 1] & [1; a(1:n-1,1) - a(2:n,1) <
>> 0]);
>> that will find all indexes of the peaks in the data in a single statement
> 
> If you set
>  a = [1 2 3 4 5 4 3 2 1 2 3 2 1]';
> Peaks will only find 5, not the 3 as well.  I will see if somehow,
> however, I can modify my code not to use a for-loop, rather to use a
> similar notation to above.

Another routine called extr.m that calculates both extrema and zero
crossings is at

http://perso.ens-lyon.fr/patrick.flandrin/emd.html

That routine is part of a package based on the Empirical Mode Decomposition
approach that does, in my opinion, a much better job of finding frequency
content of a signal than the classical fft approach. The fft assumes that
signals are strictly periodic and stationary, EMD does not.

Joe Koski



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]