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 12:12:25 -0400

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

> On 17 October 2011 17:21, Ben Abbott <address@hidden> wrote:
> 
> 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
> 
> thanks Ben for ur reply.....well here is the figure attached....just a small 
> description...
> First peak is reference peak
> second small peak is unwanted signal (top right on the big peak) which I want 
> to remove......
> 
> so I want to get the max (amplitude) and position of first peak (which u 
> already explained) now second peak amplitude and position and then third big 
> bump position and amplitude.....after that I am using leasqr to fit this 
> data....thanks for ur help.....

I expect a proper solution will take some work.

It looks to me as if all peaks may be approximated as Weibull (are the 
functions equal to zero for x = 0?). If that is the case, it should be possible 
to use fsolve() to fit a composite of three Weibull distributions.

        http://en.wikipedia.org/wiki/Weibull_distribution

Once you have a composite of the distributions you calculate the position of 
the peaks by setting the derivative of each to zero.

Ben






reply via email to

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