help-octave
[Top][All Lists]
Advanced

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

matlab code: isovalues and isosurface


From: Uwe Brauer
Subject: matlab code: isovalues and isosurface
Date: Fri, 15 Jul 2011 18:51:20 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) XEmacs/21.5-b29 (linux)

Hello

I would like to switch from matlab to octave.
Most of the code in questions run flawlessly in octave.

However the following bit of code  is tougher. 


The matlab code plots in, a more or less sophisticated way,
levels of the atomic orbits.  The code I have attached
below, it contains two commands  which are not defined in
octave, namely camlight and daspect. Both make the plot look
nicer but are not strictly necessary. All the other
functions are in principle defined in octave. However the
code does not run I obtain the following error


Thanks in advance for any help

Uwe Brauer 
,----
| error: number of columns must match (0 != 6)
| error: called from:
| error:   /usr/share/octave/3.2.3/m/plot/__patch__.m at line 46, column 12
| error:   /usr/share/octave/3.2.3/m/plot/patch.m at line 55, column 5
| error:   
/home/oub/ALLES/tex/vorlesungen/11-12/Calculo-Comput_11_12/Cuantica/orbitales_auto.m
 at line 13, column 12
`----


The code in question is 
,----
| [x,y,z]=meshgrid(-20:.5:20);
| Psi=FdOn320(x,y,z);
| m=min(Psi(:));
| M=max(Psi(:));
| color=[1 1 0;1 0 1; 0 1 1;0 1 0;1 0 0; 0 0 1; 0 0 0];
| n=5;
| for i=1:n
|     isovalue=m+i*(M-m)/n;
|     fv = isosurface(x,y,z,Psi,isovalue);
|     hpatch = patch(fv);
|     isonormals(x,y,z,Psi,hpatch);
|     Alphalevel=0.2+0.8*i/n;
|      
set(hpatch,'FaceAlpha',Alphalevel,'FaceColor',color(i,:),'EdgeColor','none')
|      set(hpatch,'FaceColor',color(i,:),'EdgeColor','none')
| %     daspect([1,1,1])
|      view(3); 
|      axis tight
| %     camlight left; 
| end
| 
| 
`----

,----
| 
| function Psi=FdOn320(x,y,z)
| r=sqrt(x.^2+y.^2+z.^2);
| Psi=exp(-r./3).*(3*z.^2-r.^2).*2*sqrt(15/(120*pi))/81;
`----



reply via email to

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