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

3 次查看(过去 30 天)
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

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)

类别

Help CenterFile Exchange 中查找有关 Get 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