MATLAB: How can get a better Polynomial out of this data

graphsinterpolationMATLABpolynomials

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
clc
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);
p1=polyfit(xx,s,3);%****
disp(p1)%** not accurate enough!!!
figure;
plot(x,y,'ko',xx,s,'linewidth', 2 );
grid on
xlabel('Angle in Degrees')
ylabel('Velocity Percentage')
set(gca,'XTick',[0:20:360]);
set(gca,'XTickLabel',[0:20:360]);
set(gca,'YTick',[0:10:110]);
set(gca,'YTickLabel',[0:10:110]);
xlim([0 360])
ylim([0 110])

Best Answer

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.