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

2 ビュー (過去 30 日間)
Anik Mukhopadhyay
Anik Mukhopadhyay 2022 年 4 月 14 日
コメント済み: Sam Chak 2022 年 4 月 14 日
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.

回答 (2 件)

Alan Stevens
Alan Stevens 2022 年 4 月 14 日
Try
help trapz

Sam Chak
Sam Chak 2022 年 4 月 14 日
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 件のコメント
Sam Chak
Sam Chak 2022 年 4 月 14 日
This is a rough estimation:
Areas of a Triangle plus a Rectangle:
(30 + 42)*150/2 + (180 - 150)*42
ans = 6660

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by