MATLAB symbolic definite integration error while taking symbolic function as input arguments
Mostrar comentarios más antiguos
The code is
syms v T;
int(@(x) x*v, 0, T)
int(@(tau) tau*v, 0, T)
I expect the answers to be
but the second definite integration incorrectly contains τ.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 4 de Nov. de 2024
syms a v T
disp(int(@(tau) tau*v, 0, T))
disp(int(@(tau) tau*a, 0, T))
Notice that in the first case, it integrated with respect to v and kept tau constant, but in the second case it integrated with respect to tau and kept a constant.
What is happening is the anonymous function is being automatically converted to a symbolic expression (not a symfun !), and then the symbolic expression is being integrated with respect to the default variable. The default variable happens to be different between [tau, v] and [tau, a]
It is arguably a bug. On the other hand, no behaviour is documented for int() of anonymous functions.
1 comentario
Walter Roberson
el 4 de Nov. de 2024
I submitted a case about this.
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!