octave-maintainers
[Top][All Lists]
Advanced

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

polyval discussion


From: Robert T. Short
Subject: polyval discussion
Date: Sat, 23 Jul 2011 10:30:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/20091017 SeaMonkey/2.0

I have some questions about polyval. Depending on the outcome of this discussion I will submit patches as necessary.

-----------------------
First, a MATLAB compatibility issue.

If we have a matrix

p = [ [ 1 2 ];
         [ 3 4 ] ];

and we attempt to evaluate p

p = polyval(p,1)

octave errors - p must be a vector.  MATLAB on the other hand returns

p = 4

MATLAB seems to use the first column as the polynomial.

Personally, I think the MATLAB approach makes no sense, but should polyval emulate MATLAB?

-----------------------
Second, here is what I would REALLY like polyval to do.

If p is a matrix, I would like polyval to return a vector in which each row is treated as a polynomial. That is, for the example above,

p = polyval(p,1)

would return

p= [3;7]

The modifications to polyval to do this are very simple but this is decidedly not MATLAB compatible.

I could submit a new function, say mpolyval, but the new function would be a near clone of polyval.

-----------------------

Comments?

Bob


reply via email to

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