handling variables symbolically, passing function handles

2 views (last 30 days)
Hello,
I am writing code to solve a double integral numerically.
the outer integral solves using gauss quadrature, and I have a completely separate function for that. The problem I am having is that the integration limits of the inner integral are in terms of "x". I have attached a picture of the integral.
now I understand how function handles so im not entirely clueless, here is what I have done.
upper=@(x) 1+x^2; //upper integration limit
lower=@(x) 2*x^2 //lower integration limit both in terms of "x"
f=@(x,y) 2*x + y - x*y^2 // the function to be integrated
now the integral will have to be solved in terms of x first, in other words, x will have to remain SYMBOLIC, but when I try to pass the integration limits into f(x,y) it gets mad that x has not been defined. furthermore I will have to pass the function that I get from this numerical integration to another kind of numerical integration. So again I will have to pass an Anonymous Function. Does anyone have any ideas as to how I can go about doing this? I have been researching it for a while and I cant find many topics like this one.

Answers (1)

Walter Roberson
Walter Roberson on 12 Dec 2013

Community Treasure Hunt

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

Start Hunting!