필터 지우기
필터 지우기

Fitting a quadratic model with the coefficient of linear term fixed

조회 수: 34 (최근 30일)
Anand P
Anand P 2020년 3월 19일
답변: Ameer Hamza 2020년 3월 19일
A quadratic equation is given by y = ax^2 + b^x +c.
Matlab function 'fit' is used to fit a relation between input and output.
I need to fit a quadratic function between input and output with the coefficient b fixed. How is that done in MATLAB?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 3월 19일
You can use fittype to specify the type of function you want to fit
x = linspace(0, 2, 100);
y = 2*x.^2 + 3*x + 4;
ft1 = fittype('a*x^2+b*x+c');
fit1 = fit(x',y',ft1);
ft2 = fittype('a*x^2+2.5*x+c'); % <--- fix the coefficient of x
fit2 = fit(x',y',ft2);

추가 답변 (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