Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!w3g2000hsg.googlegroups.com!not-for-mail
From:  "G.A.M." <x0Zero@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to count number of spikes in a signal (related to noise)
Date: Wed, 03 Oct 2007 16:23:21 -0000
Organization: http://groups.google.com
Lines: 60
Message-ID: <1191428601.605366.247270@w3g2000hsg.googlegroups.com>
References: <fdtm0l$hp2$1@fred.mathworks.com>
NNTP-Posting-Host: 24.129.101.179
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1191428601 23671 127.0.0.1 (3 Oct 2007 16:23:21 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 3 Oct 2007 16:23:21 +0000 (UTC)
In-Reply-To: <fe05uh$h0r$1@fred.mathworks.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: w3g2000hsg.googlegroups.com; posting-host=24.129.101.179;
Xref: news.mathworks.com comp.soft-sys.matlab:431209



On Oct 3, 9:37 am, "Dave Robinson" <dave.robin...@somewhere.biz>
wrote:
> "Aslak Grinsted" <r...@phunck.cmo> wrote in message
>
> <fe02ea$md...@fred.mathworks.com>...
>
>
>
> > > L=extr(x);
> > > Nmax=sum(L(1));
> > > Nmin=sum(L(2));
>
> > > Total number of spikes is
> > > N=Nmax+Nmin;
>
> > > Hope it helps.
> > > Mira
>
> > yes you could use extr from the file exchange but you
> > probably still need to remove the parabola shape from the
> > signal. I think that wavelets is a bit overkill my self.
> > Perhaps you can subtract a windowed mean:
>
> > L=extr(x-smooth(x,10));
>
> > or something similar ... or if it truly is like a
> parabola
> > then perhaps you could robustfit to find a good set of
> > model parameters and subtract that before counting local
> > extrema.
>
> > Also take a look at the stats output from robustfit. It
> > might be exactly the kind of things you need
> > for "quantifying the noise".
>
> The reason that I originally suggested using Wavelets, is
> that I thought it might be more robust than conventional
> smoothing, as the original question never stated that noise
> came from a zero mean distribution.


You are correct. I need to do a lot of work in regard to the error
distribution. So far I am just using my domain knowledge. I believe
the errors tend to be more negative than positive and I do not believe
the mean is zero.


>This could have
> ramifications to the shape of the recovered 'base'
> distribution if the noise had a bias.
>


In practice, the median filter seems to work well. But that's just an
untested assumption at this point. I have not tried wavelets because I
don't know how to use a wavelet smooth yet (and I haven't found the
help I need in the ML documentation yet).