[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 07:37:45 -0400 |
User-agent: |
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3) Gecko/20030312 |
cctsim wrote:
Hi all,
I have written the c++ code below to implement a
puncher funtion for a soft limiter.
By definition, that is
f(x)=x for -A<=x<=A and
f(x)=0 otherwise
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.
max(puncher([-5:0.1:5],5))
ans = 4.9000
which is wrong !!
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.
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
-------------------------------------------------------------