Best Cubic Polynomial fitting
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a data set (a versus b, see the attached file and the attached figure).
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.
![fig1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/201126/fig1.png)
0 Kommentare
Antworten (1)
Torsten
am 22 Jan. 2019
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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!