Difference between integral and quad functions
Afficher commentaires plus anciens
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.
1 commentaire
george veropoulos
le 19 Août 2016
i wwant to use the integral bit the limits of intgration are vector.... when i rum my code the message Error using integral (line 86) A and B must be floating point scalars. are produce what i must do?? thank you in advance Goerge
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!