MATLAB: How to extract inputs of a function in an expression

function inputwhich function

Hello everyone,
when having an expression like:
equ = 5 + int(exp(log(x)^2),0,5) – x^2 + int(sin(log(x)^2),0,5);
How can I, for each int(), extract it's input. Is there a matlab function that can do that?
In the end I would like to have something like:
IntInput= {exp(log(x)^2),0,5;…
sin(log(x)^2),0,5}
Thank you!

Best Answer

syms x
equ = 5 + int(exp(log(x)^2),0,5) - x^2 + int(sin(log(x)^2),0,5);
intInput = children(findSymType(equ, 'int'));
celldisp(intInput)
intInput{1}{1} =
intInput{1}{2} =
x
intInput{1}{3} =
0
intInput{1}{4} =
5
intInput{2}{1} =
intInput{2}{2} =
x
intInput{2}{3} =
0
intInput{2}{4} =
5
Related Question