Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!y42g2000hsy.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:10:02 -0000
Organization: http://groups.google.com
Lines: 39
Message-ID: <1191427802.839837.110170@y42g2000hsy.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 1191427803 20748 127.0.0.1 (3 Oct 2007 16:10:03 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 3 Oct 2007 16:10:03 +0000 (UTC)
In-Reply-To: <fe02ea$md4$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: y42g2000hsy.googlegroups.com; posting-host=24.129.101.179;
Xref: news.mathworks.com comp.soft-sys.matlab:431206



On Oct 3, 8:37 am, "Aslak Grinsted" <r...@phunck.cmo> wrote:
> > 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".

Thank you for your reply. Your two suggestions both sound very
intriguing. I will try both. I am currently smoothing with a median
filter and it works very well.

Using extr on the differences between the raw signal and the median
filtered signal is something I will try.

I also like the idea of using the stats from robustfit and I will try
this to see how well it works.

Your replies have been very helpful.