Intergrating the data using a scalar value

조회 수: 9 (최근 30일)
Vishnuvardhan Naidu Tanga
Vishnuvardhan Naidu Tanga 2021년 10월 12일
댓글: Mathieu NOE 2021년 10월 12일
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
Vishnuvardhan Naidu Tanga 2021년 10월 12일
Thank you once again for sorting the thing out. Have a nice day.
Mathieu NOE
Mathieu NOE 2021년 10월 12일
my pleasure (again) !

댓글을 달려면 로그인하십시오.

추가 답변 (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