how to Integrate a vector ?

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 日

1 投票

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.

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

カテゴリ

タグ

質問済み:

2015 年 5 月 6 日

コメント済み:

2015 年 5 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by