help-octave
[Top][All Lists]

## Re: Puncher soft limiter !!!

 From: cctsim Subject: Re: Puncher soft limiter !!! Date: Wed, 4 Jun 2003 16:28:21 +0100 (BST)

```On Wednesday 04 Jun 2003 12:37 pm, Paul Kienzle wrote:

> Try max([-5:0.1:5]).  You may find
> that it is 4.9.  Or it may be that it is
> a tiny bit above 5 due to cumulative
> rounding error when adding 0.1.
>
> Next try max(linspace(-5,5,101)), and
> see if that is any better.

I tried the following:
>> format long
>> max([-5:0.1:5])
ans = 5.00000000000000

The only the thing that seems to work is:

>> max(puncher(linspace(-5,5,101),5))
ans = 5

but now I am not sure if this 100% unconditional !

> You should find the perfomance of
>     x(x<-A | x>A) = 0;
> acceptable unless your arrays are
> really large in which case you will
> run into other problems. No need
> for C++ here.

x(x<-A | x>A) = 0;
This is cool !!! But still suffers from the same problem.
Is there any way not to overwrite x without using dummy variables ?

I know C++ seems a bit overkill for the puncher but my plan
was to use it as a template for the Hampel soft limiter for
complex signals which is computationally more complicated.
I have it running using a conventional m-function but is very slow.

On Wednesday 04 Jun 2003 12:24 pm, Lorenzo Fiorentini wrote:

> Try adding eps or 2*eps or step/10 to b, or use a different sintax like
> (a+[0:n]*(b-a)/n).

I tried the following but it doesn't work:
max(puncher([-5:0.1:5+eps],5))
ans = 4.90000000000000

max(puncher([-5:0.1:5+2*eps],5))
ans = 4.90000000000000

Anyway, the input signal in my case is a random signal
so it is not that critical.

Many Thanks
cctsim

__________________________________________________
Yahoo! Plus - For a better Internet experience
http://uk.promotions.yahoo.com/yplus/yoffer.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
-------------------------------------------------------------

```