how to fit a signal using polynomial fit with hogher order?

I have a amplitude value with time period of a signal. I am trying to fit this signal by polynomial fitting. I have attached the amplitude vaueand written the code but it is not fitting. Is it possible to it using higher order of polynomial. I want to fit the curve using higher polynomial order (i.e. greater than 9) but it is not done. Please help me to solve this,
tt=0:2:3601;
tt=tt';
filename = 'value.xlsx';
A = xlsread(filename);
f1=fit(tt,A,'poly9');
plot(f1,tt,A);

4 Comments

How you expect to fit a polynomial to a random data? You cannot. By the way what is the necessity to fit a polynomial to random data?
Also, order 9 is a rather high degree for a polynomial fit. You're getting into a numerically unstable regime when you go that high. For example, notice that very small errors in the coefficients of poly(1:9) give you not so small errors in the roots:
>> p=poly(1:9) + 1e-7*randn(size(p));
>> roots(p).'
ans =
9.0020 7.9944 7.0060 5.9970 5.0007 3.9999 3.0000 2.0000 1.0000
I wanted to fit polynomial to see in which order it will fit.
I recommend you use cftool to explore the fits.

Sign in to comment.

Categories

Asked:

AS
on 30 Sep 2020

Community Treasure Hunt

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

Start Hunting!