Creating a polynomial data set

조회 수: 6 (최근 30일)
Gavin
Gavin 2014년 1월 21일
답변: Jos (10584) 2014년 1월 24일
Hi all,
im currently trying to create a polynomial output of my data, basically i have a data set containing time (in seconds ( X axis)) and a tide height in meters ( Y axis) when plotted the tide data over the time series is very noisy due to wave / wind action on the vessel changing the elevation of the recording device.
so to account for this i wish to create a fitted polynomial data set under a new variable name which i can output independently of the original tide variable. this will also account for times where my measuring devise failed and im interpolating data
so far to evaluate which degree of polynomial best fits the data set i have been using the code'
poly3=(fit(time,tide,'poly3','Normalize', 'on'); % clearly i change the 'poly3' value depending upon the degree i need
this works fine for estimating a best fit from a plot of the above variable, but how do i get from this point to creating an adjusted tide height using the polynomial curve i have created.
Regards Gavin

채택된 답변

Amit
Amit 2014년 1월 21일
편집: Amit 2014년 1월 21일
you can do
tide_new = feval(poly3,time); % adjusted tide height
  댓글 수: 1
Gavin
Gavin 2014년 1월 24일
Thanks Amit this works perfectly. :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jos (10584)
Jos (10584) 2014년 1월 24일
Take a look at POLYFIT and POLYVAL as well:
PFpar = polyfit(time, tide, 3)
AdjustedTide = polyval(PFpar,time)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by