Matlab polyval function with three outputs equivalent in Python/ Numpy

Viewed 1130

I have that code in Matlab that I need to bring to Python.

x_cord = [58.2986 39.5842 23.0044 10.9427 3.0465]
y_cord = [0.9600 0.9700 0.9800 0.9900 1.0000]
[p,S,mu]=polyfit(x_cord, y_cord, 3); % p = [-0.002120716372462 0.004361710897014 -0.014104050472739 0.977080254892409]
result=polyval(p, 16.574651718139650, [], mu); % result = 0.9848

When I use numpy.polyfit(x_cord, y_cord, 3) I get different result than in example. Also I couldn't find that kind of polyval (with more than two input parameters) in Numpy.

Matlab and Numpy results are identical when I ask one return parameter.

1 Answers
Related