On Jul 20, 2011, at 7:57 AM, Uwe Brauer wrote: Regarding Re: still problems, version? (was: matlab code: isovalues and isosurface); Martin Helm <address@hidden> adds:
Hello I finally installed the new octave3.4 on my Ubuntu machine. Now the code runs without errors and the graphic I obtain is "almost identically" to the one you and Liam obtained. There is a difference: while in your case, there are 3 surfaces (as they should be) in my case I only get the lower and upper and the middle one is missing. I run it twice once with daspect once without despect. Dapsect only scales the surfaces differently. The code in question is this one: Here is the code which works for me
-------------------------------
graphics_toolkit fltk
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;
end
[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-1
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','black')
% daspect([1,1,1])
view(3);
axis tight
% camlight left;
end
-----------------------------------
I attach the surface without daspect: I am very puzzled, most like something is wrong in my installation? Uwe Brauer <mysurface-nodaspect.jpg>
That is puzzling indeed. What do you get when you plot each level separately with something like:[x,y,z]=meshgrid(-20:.5:20); 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; endfunction 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-1 isovalue=m+i*(M-m)/n; fv = isosurface(x,y,z,Psi,isovalue); subplot(2,2,i) hpatch = patch(fv); isonormals(x,y,z,Psi,hpatch); # Alphalevel=0.2+0.8*i/n; # set(hpatch,'FaceAlpha',Alphalevel,'FaceColor','interp','EdgeColor','none') set(hpatch,'FaceColor',color(i,:),'EdgeColor','black') title(strcat('orbital-', num2str(n-i))) # set(hpatch,'FaceLighting','phong') # light ("Position", [1 1 5]); daspect([1,1,1]) view(3); axis tight % camlight left; end
I get:
|