Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



numerically integrating a function of 3 variables with respect to 2 of them
Posted:
Feb 17, 2013 12:47 PM


Matlab people:
I have spent a lot of time Googling this question and I haven't found an answer. I apologize if it has been answered elsewhere. The actual mfiles I'm using are on a remote server and I don't know how to upload them here. But if someone knows the answer it should not be necessary.
I have a function H of 3 variables defined in an mfile. The function uses algebraic functions and the heaviside function. The function works. I am trying to integrate H(r0,r1,sigma) as (r0,r1) ranges over a square. I can't just use dblquad because H is a function of 3 variables. So I wrote an mfile containing the following:
function out = I2(sigma,Rmax) %second (double) integral % function out1 = Hsigma(r0,r1) out1 = H(r0,r1,sigma); end out = dblquad(Hsigma,1,Rmax,1,Rmax); % end
I get a warning about the scope of sigma spanning multiple functions. When I try to use I2, I get the following error:
>> I2(2,2) Error using I2/Hsigma (line 6) Not enough input arguments.
Error in I2 (line 10) out = dblquad(Hsigma,1,Rmax,1,Rmax);
NOTE: line 6 is "out1 = H(r0,r1,sigma); ".
Can anyone suggest a solution?
Greg



