help-octave
[Top][All Lists]
Advanced

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

Re: Mean filter


From: Robert A. Macy
Subject: Re: Mean filter
Date: Thu, 21 Jul 2005 06:57:10 -0700

In my machine the difference in speed between the two is
about the same ratio.  conv is faster.  


HOWEVER!!!

The two manipulations are *very* different.  

m1 is shorter than m2 by two times length of filtering.
m1 is "shifted to the left by length of vector.  

                     - Robert -

On Thu, 21 Jul 2005 13:44:49 +0200
 Søren Hauberg <address@hidden> wrote:
> Francesco Potorti` wrote:
> >>I'm looking for a *fast* implementation of a mean
> filter.
> > 
> > 
> > function m = meanfilter (x, ws)
> >     l = length(x);
> >     a = cumsum(prepad(x, l+1));
> >     b = a(ws+1:l)-a(1:l-ws);
> >     m = b/ws;
> > endfunction
> > 
> Thanks, I hadn't thought of that implementation - it's
> nice :-)
> Unforunaly it doesn't appear to be fast enough:
> 
> a = rand(1,100000);
> f = ones(1,100)/100;
> 
> tic; m1 = meanfilter(a, 100); toc
> ans = 0.15448
> 
> tic; m2 = conv(a, f); toc
> ans = 0.12615
> 
> Thanks,
> Søren
> 
> 
> 
>
-------------------------------------------------------------
> Octave is freely available under the terms of the GNU
> GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:
>  http://www.octave.org/funding.html
> Subscription information:
>  http://www.octave.org/archive.html
>
-------------------------------------------------------------
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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