How to Polynomial Fit on Mathcad Prime 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to Polynomial Fit on Mathcad Prime 10
Hello Mathcadeers,
I am trying to polynomial curve fitting, but could not find any good example on how to do it.
let say I have the following. How do I create a function y1(x1)? Seems Mathcad function "polyfit" function is not the right one.Thanks.
Regards,
Ak
Solved! Go to Solution.
- Labels:
-
Electrical_Engineering
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
As Terry showed, the first two arguments of the "polyfit" function have to be vectors (= column vectors in Prime, n x 1 matrices).
Row vectors (1 x n matrices) are not seen as vectors in Prime!
Another error was that you tried to numerically evaluate (the = after the definition) this function.
You have also used unfavourable data, because your three points are collinear, which means that the polynomial function would only be linear, so the coefficient of the quadratic term would be zero. This would be no problem for Prime, of course. Nonetheless I changed your data slightly.
I also used X and Y for the data vectors so I have x free to be used in the plot.
polyfit returns a function you can use to evaluate at specific positions or to plot the graph of the function.
But polyfit will not display the function term! Maybe this was it you tried by adding the equal sign at the end.
To get the values of the coefficients you have to use the polyfitc function.
The second column of its result shows the coefficients, starting with the coefficient of x^0.
Of course we could also use these coefficients to define the polynomial function:
Prime 10 sheet attached
