필터 지우기
필터 지우기

How to find polynomial coefficient

조회 수: 4 (최근 30일)
Giancarlo Mariani
Giancarlo Mariani 2017년 12월 27일
답변: Sudheer Nuggehalli 2018년 1월 2일
Hello,
I've a set of data x and y that give a curve and I wanna find an approximation of this curve using the form y=a1*x+a3*x^3. Using the function polyfit I can obtain a cubic form y=a0+a1*x+a2*x^2+a3*x^3, but I need a0 and a2 equal to 0. How can i do?
Thank you in advance.

채택된 답변

Sudheer Nuggehalli
Sudheer Nuggehalli 2018년 1월 2일
One possible way to go about doing this is to use the "fit" function, which creates the fit to the data in x and y with any custom model. The following code can be used as a starting point:
ft = fittype( @(a1,a3,x) a1*x+a3*x.^3 )
f = fit(x,y,ft)
The "fit" function requires an input argument object of type "fittype", which is created using the "fittype" function. The documentation pages below explain in greater detail how to use the "fit" and "fittype" functions, as well as detailed examples:
I hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by