Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: numerically integrating a function of 3 variables with respect to 2 of them
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
gsspradlin@yahoo.com

Posts: 3
Registered: 2/25/08
numerically integrating a function of 3 variables with respect to 2 of them
Posted: Feb 17, 2013 12:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 m-files 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 m-file. 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 m-file 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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.