Borrar filtros
Borrar filtros

Error using ^ when integrating a function

3 visualizaciones (últimos 30 días)
Fuad
Fuad el 7 de Mzo. de 2024
Respondida: Walter Roberson el 7 de Mzo. de 2024
I am attempting to integrate a function between its bounds.
fun = @(r) (1+erf((-36.38+2.56*log(5+((138.4-r)/4)*((26.964*2.71828^(-0.0238*r))^(4/3)))-5)/sqrt(2))*r);
q = integral(fun,21.2,140)
I get the below error.
Error using ^
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To operate on each element of the matrix individually, use POWER (.^) for elementwise power.

Respuesta aceptada

Walter Roberson
Walter Roberson el 7 de Mzo. de 2024
fun = @(r) (1+erf((-36.38+2.56.*log(5+((138.4-r)/4).*((26.964*2.71828.^(-0.0238*r)).^(4/3)))-5)/sqrt(2)).*r);
Use vectorized operations.

Más respuestas (0)

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