Numerical integration of a function containing symbolic characters

1 view (last 30 days)
clear
clc
E=@(x) x.^2
syms A B
var = integral(@(x) E(x).*(A*x+B),0,1)
Hello everybody,
I need to calculate this kind of integral, and expect a result, for example (10A+B).
Is there a way by using integral or quad command? (Actually anything but trapz)
Thank you.

Answers (1)

Torsten
Torsten on 26 Jun 2019
syms A B x
f = x^2*(A*x+B);
result = int(f,x,0,1)

Community Treasure Hunt

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

Start Hunting!