help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: integrating functions of more than one variable


From: Paul Kienzle
Subject: Re: integrating functions of more than one variable
Date: Sun, 30 Oct 2005 23:26:46 -0500

Marco,

Try:

   global z;
   for z = z_vec, for b = b_vec, L(b), end; end;

- Paul

On Oct 30, 2005, at 11:05 PM, marco wrote:

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!

--
address@hidden
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
-------------------------------------------------------------




-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]