From help-request at octave dot org Sun Oct 30 22:08:13 2005 Subject: integrating functions of more than one variable From: marco To: help at octave dot org Date: Sun, 30 Oct 2005 23:05:36 -0500 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 I could go about this? I'm running octave 2.1.71. Thank you! -- marco at reimeika dot ca 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 -------------------------------------------------------------