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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (2)

Alan Stevens
Alan Stevens il 14 Apr 2022
Try
help trapz

Sam Chak
Sam Chak il 14 Apr 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 Commento
Sam Chak
Sam Chak il 14 Apr 2022
This is a rough estimation:
Areas of a Triangle plus a Rectangle:
(30 + 42)*150/2 + (180 - 150)*42
ans = 6660

Accedi per commentare.

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by