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 11:21:59 -0400

On Oct 17, 2011, at 11:04 AM, preeti gaikwad wrote:

> On 17 October 2011 15:55, Ben Abbott <address@hidden> wrote:
> 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
> 
> Thanks a lot Ben.......But I just do not understand the second output of the 
> max() function is giving the position of the f(x) but still I have to find 
> the max of second peak?? and that is not giving in the help max could you 
> please help me for the same? thanks a lot in advance......

Sorry, I had skimmed your email, and tried to answer "1." I should have read 
your entire email more carefully.

Can you provide more information? May be a plot of the signal?

Ben


reply via email to

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