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

2 vues (au cours des 30 derniers jours)
Anik Mukhopadhyay
Anik Mukhopadhyay le 14 Avr 2022
Commenté : Sam Chak le 14 Avr 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.

Réponses (2)

Alan Stevens
Alan Stevens le 14 Avr 2022

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by