MATLAB Answers

How can get a better Polynomial out of this data?

2 views (last 30 days)
Seba.V on 11 Apr 2020
Commented: Seba.V on 11 Apr 2020
Hello everyone,
I am trying to obtain a sensible polynomial out of the following potted data. It seems to me that the results I am obtaining are not very precise and don' really reflect the curve obtained. Is there another way I could get a better polynomial describing the plotted data?
Thank you in advance.
clear all
close all
x=[0 54 174 250 282 330 355]; % Degrees
y=[98 17.95 46.51 48.37 11.16 74.4 100];%percentage
xx= (0:0.5:360);
s = spline(x,y,xx);
disp(p1)%** not accurate enough!!!
plot(x,y,'ko',xx,s,'linewidth', 2 );
grid on
xlabel('Angle in Degrees')
ylabel('Velocity Percentage')
xlim([0 360])
ylim([0 110])


Star Strider
Star Strider on 11 Apr 2020
The most appropriate model is a mathematical description of the process that created the data. Then use one of the nonlinear parameter estimation functions (lsqcurvefit or nlinfit) to fit the function to the data.
The present approach is likely not the best use of either spline or polyfit.
Seba.V on 11 Apr 2020
I see what you mean, Thank you.
The data describes the velocity of a four-bar linkage (coupler) determined at a specific crank angles. The spline graph obtained describes the velocity motion of a point on the coupler. I could not think of anything else than to use spline and polyfit after calculating the istantaneous velocityes at there points. Any suggestion of how I could derive a mathematical description of the eliptical motion it has?
Star Strider
Star Strider on 11 Apr 2020
My pleasure.
It would be necessary to have a mathematical expression of that system, along with a description of what the data represent and the parameters you want to estimate.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 11 Apr 2020
Lets be serious here. You have all of 7 data points, which seem to lie at virtually random values.
On top of the data, I've plotted a cubic polynomial fit through the data. Is it reasonable? Perhaps, though apparently not for your purposes.
Perhaps what you need is a shape preserving curve fit through the data points. This can be achieved using pchip, or even interp1, using the correct choice of method. I added that to the plot above, both created using the basic fitting tools on the plot.
But asking us to offer a rational model for the data, purely from that data alone is impossible. Your desciption is wildly inadequate. A spline as I prodiuce here, is probably as much as can be done. In fact, it may well be the case that the best "model" of that process is whatever procedure you have that produced the data.
We do not know if the process that produces this data is noisy. So are those exact, true, repeatable numbers? Are those bumps in the process worth chasing? If so, then you need to use an interpolating tool, and for data like this, pchip is by far the best choice, as a classical spline would do very nasty things to your data.
If you could obtain more data, that would improve your odds of success.

  1 Comment

Seba.V on 11 Apr 2020
Thank you all, that was very helpful.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by