Undefined function 'int' for input arguments of type 'double'.

I am trying to integrate a function of propulsive power (positive values only) with respect to time to give energy. The propulsive power is in the form of a 10321x1 double matrix. The time is to range between 0 and 1032.1 seconds. The code I am inputting is as follows:
E = integral(Px_Pos,0,1032.1)
I am greeted with the error: Undefined function 'int' for input arguments of type 'double'. Can someone please help me?
I am new to MatLab and so my apologies if this is a trivial question.

 Respuesta aceptada

Torsten
Torsten el 22 de En. de 2018
Use "trapz" instead of "integral".
Best wishes
Torsten.

3 comentarios

Hi Torsten,
Many thanks for the quick reply.
Using 'trapz' I received the following:
Energy = trapz(Px_Pos,0,1032.1) > In trapz (line 37) Warning: ORDER contains non-integer indices. This will return an error in a future release. Error using message Error filling holes for MATLAB:trapz:LengthXmismatchY. Floating point numbers are not allowed as holes. They should be converted to character vectors.
Error in trapz (line 57) error(message('MATLAB:trapz:LengthXmismatchY',dim));
Put your times in a 10321x1 vector T as well as the propulsive power in a 10321x1 vector P.
Then call "trapz" as
I = trapz(T,P).
Best wishes
Torsten.
Torsten,
Many thanks for your help, this has worked.
Kind regards, Matt

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 22 de En. de 2018

Comentada:

el 28 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by