On Jul 23, 2011, at 12:30 PM, Robert T. Short wrote:
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.
Might using cell array for the multiplicity of coefficients be a better idea?
Using cells should be easy to parse without introducing an incompatibility with
Matlab.
Ben