How to find Area Under the Curve of a Smoothing Spline Curve Fitted Model from Discrete Data Points ?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For example: I have 12 y values for different 12 x values and by using MATLAB inbuild app of Curve Fitting I got very good result. But now I want to read these coefficients in an equation (which I don't have) and want to know the area under the curve ?
M = [0.3 0.55 0.6 0.7 0.8 1.2 1.4 2.0 2.5 3.0 3.5 4.0];
Cd = [0.0010640542,0.0010009253,0.00097260155,0.0013098622,...
0.0019386101,0.027396185,0.033348465,0.041169242,0.040609591,...
0.040801537,0.041328469,0.042925609];
Got these as outputs after using the Curve Fitting App (Smoothing Spline):
Smoothing spline:
f(x) = piecewise polynomial computed from p
Smoothing parameter:
p = 0.99999298
Goodness of fit:
SSE: 6.345e-09
R-square: 1
Adjusted R-square: 1
RMSE: 0.0001337
Got the coefficients as:
fittedmodel1.p.coefs
ans =
-0.0017 0 -0.0002 0.0011
0.2595 -0.0013 -0.0005 0.0010
-0.2389 0.0376 0.0013 0.0010
0.9024 -0.0340 0.0017 0.0013
-0.3322 0.2367 0.0219 0.0020
0.2633 -0.1620 0.0518 0.0274
-0.0088 -0.0040 0.0186 0.0334
0.0184 -0.0199 0.0042 0.0412
-0.0063 0.0077 -0.0019 0.0406
0.0037 -0.0018 0.0011 0.0408
-0.0024 0.0037 0.0020 0.0413
0 commentaires
Réponses (1)
darova
le 5 Sep 2021
Use code instead of application
x = [0.3 0.55 0.6 0.7 0.8 1.2 1.4 2.0 2.5 3.0 3.5 4.0];
y = [0.0010640542,0.0010009253,0.00097260155,0.0013098622,...
0.0019386101,0.027396185,0.033348465,0.041169242,0.040609591,...
0.040801537,0.041328469,0.042925609];
x1 = linspace(x(1),x(end)); % new x mesh
y1 = spline(x,y,x1); % inrpolation with splin
plot(x,y,'.r')
line(x1,y1)
trapz(x1,y1) % trapezoid summation
0 commentaires
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!