This is my MATLAB code. The function trapezoidal() is defined separately and it works fine.
syms x; f = 10 + 2 * x - 6 * (x^2) + 5 * (x^4); a = 0; b = 2; ans_
The problem is in using the function int
int
actual_ans = int(f, 0, 2);
`actual_ans' is still a symbolic variable, even if it is a constant. You can translate it into a numeric variable with
actual_ans = double(actual_ans);