Intergrating the data using a scalar value

2 次查看(过去 30 天)
Hello,
I am trying to do integration of a excel data. When I try to do that I am getting an error as follows:
Error using cumtrapz (line 51)
Dimension argument must be a positive integer scalar within indexing range.
Please can someone help me in solving that .
My code:
X1 = xlsread('Abb76at104.xlsx','A1:A63');
Y1 = xlsread('Abb76at104.xlsx','B1:B63');
V = 40.020;
A1 = pi*(X1).^2;
Q1 = A1.*Y1;
Int1 = cumtrapz(A1, V);
X2 = xlsread('Abb76at104.xlsx','A64:A130');
Y2 = xlsread('Abb76at104.xlsx','B64:B130');
A2 = pi*(X2).^2;
Q2 = (A2).*40.02;
Int2 = cumtrapz(A2, V);
Thanks in advance.

采纳的回答

Mathieu NOE
Mathieu NOE 2021-10-12
hello
see the doc for cumtrapz
I believe you simply put the arguments in the wrong order
it must be
Int1 = cumtrapz(V,A1);
and
Int2 = cumtrapz(V,A2);
  8 个评论
Vishnuvardhan Naidu Tanga
Thank you once again for sorting the thing out. Have a nice day.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by