octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #42050] fplot does not work with anomynous fun


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #42050] fplot does not work with anomynous function handle
Date: Fri, 04 Apr 2014 16:38:13 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130917 Firefox/17.0 Iceweasel/17.0.9

Follow-up Comment #2, bug #42050 (project octave):

I'm not sure about 3.2.4, but in 3.8.1, the problem is that fplot is passing a
vector to the function instead of calling it N times with a scalar value each
time.  So when you write 1/x, you're finding some minimum norm solution to an
underdetermined linear equation, not finding the reciprocal for each value in
the vector X.

If this works in Matlab, then I guess they are calling the function N times in
a loop (maybe with arrayfun?).  In any case, it will be slower to call the
function for each element of the vector, but maybe it's what we have to do.

You can avoid the problem by defining your function so that it works properly
for vector inputs:


h = @(x) 1 ./ x


That should work properly in Matlab or Octave.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42050>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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