Hello everyone, anyone knows how to approximate a data with polynomial of degree 8 using least square method?
    5 次查看(过去 30 天)
  
       显示 更早的评论
    
Polynomial degree is 8 and it should be approximated piecewise.
- y = a0t0 + a1t1 + a2t2 +… + antn ………………………….. (1)
Data description:
The first column is Time(GPS format) unit is seconds.
Second column is y values, so I have to find the coefficients (a0, a1...). And this should be done peicewise (9 points), then iterate this method till the end of the data.
Data is attached.
5 个评论
回答(2 个)
  Walter Roberson
      
      
 2021-6-25
        Loop, moving one point at a time. At each location use polyfit on 9 points to create coefficients. polyder() https://www.mathworks.com/help/matlab/ref/polyder.html and evaluate to get velocity. polyder() again and evaluate to get acceleration.
Then move one point further on.
0 个评论
  David Hill
      
      
 2021-6-25
        
      编辑:David Hill
      
      
 2021-6-25
  
      Use polyfit, place the x and y columns of your data into the function.
p=polyfit(x,y,8);%you will need to convert time using datenum and likely normalize
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Splines 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




