Can someone briefly explain to me the difference between the integral and quad functions? I know that they will give different answers because of different algorithms but usually the results are close.
In my case I have a function of 2 variables f(x,y). Say I integrate over y from a to b using integral so I have
g(x) = integral(@(y) f(x,y),a,b).
Suppose now that I solve for the roots of g and I find a root at x_0. If I test this solution is correct by
integral(@(y) f(x_0,y),a,b) I get something of the power e^-17.
If instead I use quad(@(y) f(x_0,y),a,b) I get 0.0365.
Moreover whether I compute g(x) using integral or quad makes a huge difference as the solution x_0 I am getting from g(x)=0 is very different in the 2 cases.
Best Answer