How to take and integral of a matrix

354 visualizaciones (últimos 30 días)
Antonio Belmaggio
Antonio Belmaggio el 29 de Mayo de 2020
Comentada: Ameer Hamza el 31 de Mayo de 2020
Hi
I got this matrix 2x1 that i have to integrate, matrix's elements are constants and I have to integrate in two finite values (0 and 12).
I am using the command integral(fun,0,12) but it keeps giving me errors like : First input argument must be a function handle.
Or when I use int(fun,0,12) it gives me another error : Undefined function 'int' for input arguments of type 'double'.
this time i als tried to put int ('fun',0,12) but it gives me this: Undefined function 'int' for input arguments of type 'char'.
Can anyone help?

Respuestas (1)

Ameer Hamza
Ameer Hamza el 29 de Mayo de 2020
Editada: Ameer Hamza el 29 de Mayo de 2020
You can integrate a constant matrix by simply multiplying it with the length of the interval.
M = [1 2];
M_int = M*(12-0)
However, if you want to use integral() the following shows the correct syntax
M = [1 2];
fun = @(x) M;
integral(fun, 0, 12, 'ArrayValued', 1)
  2 comentarios
Antonio Belmaggio
Antonio Belmaggio el 30 de Mayo de 2020
Thank you, it now works!
Ameer Hamza
Ameer Hamza el 31 de Mayo de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices 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