help-octave
[Top][All Lists]

## integrating functions of more than one variable

 From: marco Subject: integrating functions of more than one variable Date: Sun, 30 Oct 2005 23:05:36 -0500 User-agent: Mutt/1.4.2i

```Hi all,

I've succesfully integrated a function k(x,z) by using
the "global" trick e.g.:

global z = 1.5;
global a = -pi/2;

function r = k(x)
global z;
r = 2*sin(x).*sqrt((z + sin(x)));
endfunction

function [r, stat, iter, err] = L(b)
global a;
[r, stat, iter, err] = quad("k", a, b);
endfunction

I later make a plot of "L" as a function of the upper limit
"b" (with z constant).

However, I would like now to make a 3d plot of L as a function
of both "b" and "z" (say, by making two nested loops, one
over "b" and the other one over "z" e.g. "for z_i = z_vec").
Unfortunately, I'm stuck. I've tried the "global" trick by
running "clear z" and re-declaring "global z = z_i" in the
loop but you can only declare a global once. Any ideas on how

Thank you!

--
Gunnm: Broken Angel                      http://amv.reimeika.ca
http://reimeika.ca/                      http://photo.reimeika.ca

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```