Best Cubic Polynomial fitting

2 次查看(过去 30 天)
Naresh Pati
Naresh Pati 2019-1-22
回答: Torsten 2019-1-22
I have a data set (a versus b, see the attached file and the attached figure). fig1.png I want to find the coefficients p and q of the cubic polynomial b=p*a+q*a^3 that fits the data. Please help.

回答(1 个)

Torsten
Torsten 2019-1-22
mat = [a a.^3];
rhs = b;
sol = mat\rhs;
p = sol(1)
q = sol(2)
fun=@(x) p*x + q*x.^3;
bb = fun(a);
plot(a,b,a,bb)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by