[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: matlab code: isovalues and isosurface
From: |
Liam Groener |
Subject: |
Re: matlab code: isovalues and isosurface |
Date: |
Fri, 15 Jul 2011 14:53:44 -0700 |
On Jul 15, 2011, at 9:51 AM, Uwe Brauer wrote:
>
> 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
Hi,
I'm not knowledgeable enough to be of much help. However, a couple of
observations may be useful clues to others:
(1) The failure comes because fv is computed to be empty when i = n, that is
when isovalue = M (the maximum value in Psi).
(2) What I find very confusing is that the failure occurs almost instantly when
the for loop is run from 1 to n, but the code runs for more than a minute
(without failue) if the loop is run from 1 to n-1. It seems like it is actually
running it from n to 1 in the former case?
I would attach the plot resulting from the 1:n-1 case but it is 11 MB long (in
pdf form). The final graph is pretty uninteresting; it looks pretty much like
three stacked disks, a central yellow one with smaller purple ones above and
below. (Actually there is a bit of an even smaller disk showing too.) However,
opening the file takes a few seconds and it builds like a movie. This 'movie'
allows you to see more detail as the orbitals build.
- matlab code: isovalues and isosurface, Uwe Brauer, 2011/07/15
- Re: matlab code: isovalues and isosurface,
Liam Groener <=
- Re: matlab code: isovalues and isosurface, Martin Helm, 2011/07/16
- Re: matlab code: isovalues and isosurface, Liam Groener, 2011/07/16
- Re: matlab code: isovalues and isosurface, Martin Helm, 2011/07/16
- Re: matlab code: isovalues and isosurface, Uwe Brauer, 2011/07/16
- Re: matlab code: isovalues and isosurface, Martin Helm, 2011/07/16
- still problems, version? (was: matlab code: isovalues and isosurface), Uwe Brauer, 2011/07/16
- Re: still problems, version? (was: matlab code: isovalues and isosurface), Martin Helm, 2011/07/16
- Re: still problems, version? (was: matlab code: isovalues and isosurface), Martin Helm, 2011/07/16
- precompiled 3.4 for Debian/Ubuntu: was Re: still problems, version?, Uwe Brauer, 2011/07/17
- Re: precompiled 3.4 for Debian/Ubuntu: was Re: still problems, version?, Jordi GutiĆ©rrez Hermoso, 2011/07/17