Fitting a quadratic model with the coefficient of linear term fixed
52 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Anand P
el 19 de Mzo. de 2020
Respondida: Ameer Hamza
el 19 de Mzo. de 2020
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?
0 comentarios
Respuesta aceptada
Ameer Hamza
el 19 de Mzo. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!