필터 지우기
필터 지우기

Fitting a linear sine curve with polynomial curve

조회 수: 2 (최근 30일)
Abi sek
Abi sek 2018년 2월 26일
댓글: Abi sek 2018년 2월 26일
I don't have any data points. I have seen your past answers of fitting the sinusoidal function using pure Matlab functions. But those coefficients is for non-linear sinusoidal function. Can you assist me in fitting a linear sine curve between o and 2pi with the polynomial curve of power 4? I am a noobie at Matlab coding. Kindly assist for the same.
  댓글 수: 2
Torsten
Torsten 2018년 2월 26일
What sine-curve s(x) do you have in mind ?
s(x) = ?
Abi sek
Abi sek 2018년 2월 26일
Hi Torsten, just we can proceed with s(x) =sin(x)

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

채택된 답변

Torsten
Torsten 2018년 2월 26일
편집: Torsten 2018년 2월 26일
x=linspace(0,2*pi,100);
x=transpose(x);
A=[ones(numel(x),1),x,x.^2,x.^3,x.^4];
b=sin(x);
sol=A\b; % Polynomial is given by sol(1)+sol(2)*x+sol(3)*x^2+sol(4)*x^3+sol(5)*x^4
Best wishes
Torsten.
  댓글 수: 4
Torsten
Torsten 2018년 2월 26일
편집: Torsten 2018년 2월 26일
polynomial=sol(1)+sol(2)*x+sol(3)*x.^2+sol(4)*x.^3+sol(5)*x.^4;
plot(x,sin(x),x,polynomial,x,sin(x)-polynomial)
Abi sek
Abi sek 2018년 2월 26일
Thank you

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by