Function after spline fitting

조회 수: 3 (최근 30일)
Balint Egri
Balint Egri 2021년 3월 26일
댓글: Balint Egri 2021년 4월 1일
Hello hello,
I have a question regarding spline fitting. I have the below curve which obtained by fitting a curve on my test data. (this is the roll angle of an IMU data) I used spline fitting and piecewise polynomial to have it smoothend by increasing the increment (time) 10 times.
I want to use this data in another program to create motion on a body.
Is it possible to obtain this curve az a sin/cos function? Or any kind of function?
Thank you for your answers:)
  댓글 수: 1
Balint Egri
Balint Egri 2021년 4월 1일
I attached here the .mat file where I am doing the curve fitting. I also attached the .txt files which the spli fitting reads. Hope this can help.
Do you think the fft could work with this set of data?

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

답변 (2개)

John D'Errico
John D'Errico 2021년 3월 26일
You cannot extract any "function" from a spline. At least, if you did, it would not be anything you could read or type without many, many coefficients, that you problably would not find useful.
In order to build an approximation using a sum of sin and cosine terms, you will usually use a tool like the curve fitting toolbox, but the optimization or stats toolbox can also do nicely. you can also do it without any such toolbox, but it wil take more effort. So knowing what you have would be important. Also, it would greatly help to have your data.
  댓글 수: 1
Balint Egri
Balint Egri 2021년 4월 1일
I commented on the post with my data. Check it out if you think the curve fitting is a working solution:)

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


Star Strider
Star Strider 2021년 3월 26일
The easiest way to fit it to a sin or cos function (or both) to it would be to take the Fourier transform of it using the fft function. It would then be possible to reconstruct it in the time domain from the real and imaginary coefficients at the frequencies you want to use for that. (It would likely require several terms to get a decent approximation to the data.)
  댓글 수: 1
Balint Egri
Balint Egri 2021년 4월 1일
I commented my data under the post. Check it out if you think the fft is a working solution. I will lok at it later.

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

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by