필터 지우기
필터 지우기

how to Integrate a vector ?

조회 수: 1 (최근 30일)
Nick van der maat
Nick van der maat 2015년 5월 6일
댓글: John D'Errico 2015년 5월 6일
Hello,
I am trying to integrate a vector,
FuelRateINT = integrate(MAIN_EngFuelRate,MAIN_TachographVehicleSpeedTOTALROWS,1);
% MAIN_TachographVehicleSpeedTOTALROWS = number of last row
% 1 = start row
It keeps giving the error :
Undefined function 'integrate' for input arguments of type 'double'.
  댓글 수: 1
John D'Errico
John D'Errico 2015년 5월 6일
Note that integrate is not designed to integrate a data vector. As Star points out, use trapz or cumtrapz, depending on your goal.

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

답변 (1개)

Star Strider
Star Strider 2015년 5월 6일
Use the trapz or cumtrapz functions:
FuelRateINT = trapz(MAIN_EngFuelRate,MAIN_TachographVehicleSpeedTOTALROWS);
or:
FuelRateINT = cumtrapz(MAIN_EngFuelRate,MAIN_TachographVehicleSpeedTOTALROWS);
depending upon what you want.
  댓글 수: 2
Nick van der maat
Nick van der maat 2015년 5월 6일
Both of these are giving me straight zero's.
Star Strider
Star Strider 2015년 5월 6일
That has to do with your data. Post your data (or a representative sample, preferably as a .mat file). It is impossible to figure out the problem without them.

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

카테고리

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