help-octave
[Top][All Lists]
Advanced

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

Re: Puncher soft limiter !!!


From: Paul Kienzle
Subject: Re: Puncher soft limiter !!!
Date: Wed, 04 Jun 2003 19:15:27 -0400
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3) Gecko/20030312

cctsim wrote:

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

try:  max([-5:0.1:5])-5


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 !

For that, you will have to use the source (liboctave/dRowVector.cc):

   double delta = (x2-x1)/(n-1);
   x(0) = x1;
   for (i=0; i < n-1; i++) x(i) = x1+i*delta;
   x(n-1) = x2;

So the answer is definitely yes.

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 ?

y = x(x>=-A & x <= A);

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.

For loops in octave are slow.  If you can
express your algorithm with vector or
matrix operations, then the overhead of
octave is not a problem.

Paul Kienzle
address@hidden




-------------------------------------------------------------
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]