Double Integral numerically in matlab

5 views (last 30 days)
Brittany
Brittany on 9 Dec 2014
I am trying to solve a double integral using quadgk. t and r are values that can change so I have created a function where they are inputs.
function BF = calcBF(t, r)
B = @(x,y)(t-x-y)*(3)/(3+4*(x+y)+4*x*y)*sqrt(3)/(sqrt(3+4*(x+y))/r+(4*x*y/r.^2))
firstint = @(x)quadgk(@(y) B(x,y),0,t-x)
secondint = quadgk(@(x) firstint, 0, t)
BF = 6*secondint;
Each time I run the code however, I receive an error that "Supported classes are 'double' and 'single'" I'm sure I'm denoting something wrong within the code; however, I don't see it.

Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!