help-octave
[Top][All Lists]
Advanced

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

Re: How to find global and local maxima using octave and its position


From: Ben Abbott
Subject: Re: How to find global and local maxima using octave and its position
Date: Mon, 17 Oct 2011 09:55:07 -0400

On Oct 17, 2011, at 9:15 AM, preeti gaikwad wrote:

> Hello all, 
> 
>                If I have x and f(x) I want to find out the maxima of f(x) and 
> position of the same so for that if I write the syntax like "max(f(x))" I 
> will get it but how to get its position means the corresponding x value???? 
> 
> Now suppose I have 'n' value of x and f(x), and there I have three peaks in 
> the f(x) where one peak is the "reference peak" where I want to find (its 
> position and amplitude, width) and fit with the Gaussian function, second 
> peak coming from the actual sample. and the third is the unwanted peak in the 
> sample (called the noise).
> 
>  using octave I want to get rid of this noise peak where I know want to know 
> the width and the position to remove this 
> 
> 1. If I say max(f(x)) then I get only one peak at but how to write syntax for 
> getting position??? I already knew the width of this pulse but how to find 
> the width of the noise pulse????
> 2. how to find second peak its position and width?   
> thanks a lot in advance for solving my problem........

You just need the second output of the max() function.

        [max_value, index_of_max_value] = max (f (x));

See "help max" for more info.

You can also do ...

        index_of_max_value = find (f(x) == max(f(x)));

Ben





reply via email to

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