Borrar filtros
Borrar filtros

how to Integrate a vector ?

1 visualización (últimos 30 días)
Nick van der maat
Nick van der maat el 6 de Mayo de 2015
Comentada: John D'Errico el 6 de Mayo de 2015
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 comentario
John D'Errico
John D'Errico el 6 de Mayo de 2015
Note that integrate is not designed to integrate a data vector. As Star points out, use trapz or cumtrapz, depending on your goal.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 6 de Mayo de 2015
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 comentarios
Nick van der maat
Nick van der maat el 6 de Mayo de 2015
Both of these are giving me straight zero's.
Star Strider
Star Strider el 6 de Mayo de 2015
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by