How to get area under the fit attained by Curve Fitting tool?

2 visualizaciones (últimos 30 días)
Anik Mukhopadhyay
Anik Mukhopadhyay el 14 de Abr. de 2022
Comentada: Sam Chak el 14 de Abr. de 2022
Here I have two data arrays namely t and T. I have used the command
t = linspace(0,270,10)
T = [30 32 34.5 38.6 40 40 42 42.5 42.5 42 41.5]
cftool(t,T)
And the cftool gui to attain the following:
I want to get the area under the curve from (t=0) to (t=180). What should I use in this case. I am a complete novice to MATLAB and I do most of my work using the GUI. If anyone can help me it will be really appreciated.

Respuestas (2)

Alan Stevens
Alan Stevens el 14 de Abr. de 2022
Try
help trapz

Sam Chak
Sam Chak el 14 de Abr. de 2022
You can check if this works:
t = linspace(0, 270, 10);
T = [30 32 34.5 38.6 40 42 42.5 42.5 42 41.5];
% Create a shape-preserving piecewise interpolation from t = 0 to 180
tnew = 0:0.01:180;
pch = interp1 (t, T, tnew, "pchip");
plot(t, T, 'ro', tnew, pch, 'b-', 'linewidth', 1.5)
grid on
xlabel('t')
ylabel('T')
Area_under_blue = trapz(tnew, pch)
  1 comentario
Sam Chak
Sam Chak el 14 de Abr. de 2022
This is a rough estimation:
Areas of a Triangle plus a Rectangle:
(30 + 42)*150/2 + (180 - 150)*42
ans = 6660

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by