help-octave
[Top][All Lists]

## PS: Re: Easy tutorial on how to make 3-dimensional graphics

 From: Tetsuji \"Maverick\" Rai Subject: PS: Re: Easy tutorial on how to make 3-dimensional graphics Date: Fri, 13 Jan 2006 00:24:01 +0900 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060101 SeaMonkey/1.5a

```-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

oops, I found I've made a big mistake; I should have called "h100(larger
number)"...  However, I still don't understand what a single quote after
linspace(-8,8,n) means in sombrero...

- -Tetsuji
- -------- Original Message --------
Subject: Re: Easy tutorial on how to make 3-dimensional graphics
Date: Fri, 13 Jan 2006 00:08:40 +0900

Quentin Spencer wrote:
> Tetsuji "Maverick" Rai wrote:
>
>> Thanks!  I understood how to plot in 3-dimensional space.  Then how can
>> I "rotate" or "pitch up/down" this 3-dimension graphics display?  I
>> cannot find it in the online document 17.3 "Three-Dimensional Plotting."
>>
>>
>
> See "help view" for a way to do it from the command line. It can also be
> done interactively with the mouse in gnuplot 4.0 (I don't think you can
> in the older versions), but you need to put "set mouse" in your .gnuplot
> file in order to enable it (an uglier way is to enter
> __gnuplot_raw__("set mouse\n") in octave before you create the 3-d plot).
>
> -Quentin
>
>
>

I'm a newbie on octave.

Now I've begun writing a small function to make a 3-d plot, but I'm
stuck at linspace(,,).  Following function fails like

octave:2> h100(1)
error: linspace: npoints is 1, but x1 != x2
error: evaluating assignment expression near line 6, column 9
error: evaluating assignment expression near line 6, column 5
error: called from `h100' in file
`/home/tetsuji/physics/hydrogen-atom/h100.m'

- ----h100.m----
function h100(dn)

a0 = 1;
n = 1;

x = z = linspace (-10, 10, dn);
[xx, zz] = meshgrid (x,z);
[theta,r] = cart2pol (zz,xx);

r1 = 1 ./(n*a0);
y = r1 .^1.5 * exp(-r1*r);
y = y*y ./ pi;

mesh(x,z,y);
endfunction
- ---------------

Apparently x and z has a problem (I think I just borrowed this line from
sombrero(n)).  I must be doing something wrong, but don't know what's
wrong..  Looking at sombrero(n), I see a single quote after
linspace(-8,8,n) and a period before slash '/' or hat '^'..... What are
they??  As for math, C++ is much easier to me... very unusual :(

In above function, x and z axes are on the horizontal plane, and y axis
stands vertically.

So are there any good online tutorial for octave (not document on
www.octave.org)?

- -Tetsuji
- --
Tetsuji 'Maverick' Rai
main page http://maverick6664.bravehost.com/
PGP pubkey http://mav.atspace.com/maverick31337_at_gmail_dot_com.txt
PGP Key ID: 0x971E57CA
Key fingerprint: F790 28AF E95B 48C9 19AB  71FD 50B5 3572 971E 57CA
Aviation Jokes: http://www.geocities.com/tetsuji_rai/

- --
Tetsuji 'Maverick' Rai
main page http://maverick6664.bravehost.com/
PGP pubkey http://mav.atspace.com/maverick31337_at_gmail_dot_com.txt
PGP Key ID: 0x971E57CA
Key fingerprint: F790 28AF E95B 48C9 19AB  71FD 50B5 3572 971E 57CA
Aviation Jokes: http://www.geocities.com/tetsuji_rai/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDxnSPULU1cpceV8oRAtYpAJ93YStoOzriEEmK1Zc/5LfE7jZdkgCfRBXu
9fv103L+UW4Uoe/UaAV8PWE=
=f+9a
-----END PGP SIGNATURE-----

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

```