help-octave
[Top][All Lists]
Advanced

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

Re: still problems, version? (was: matlab code: isovalues and isosurface


From: Martin Helm
Subject: Re: still problems, version? (was: matlab code: isovalues and isosurface)
Date: Sat, 16 Jul 2011 21:36:08 +0200
User-agent: KMail/1.13.7 (Linux/2.6.34.8-0.2-desktop; KDE/4.6.5; x86_64; ; )

Am Samstag, 16. Juli 2011, 20:21:02 schrieb Uwe Brauer:
>    > Am Samstag, 16. Juli 2011, 17:25:25 schrieb Uwe Brauer:
>    > You simply type (octave 3.4)
>    > graphics_toolkit fltk
>    > at the beginning of your script or octave session. In 3.2 it was
>    > "backend fltk" as far as I remember.
> 
> Thanks but the suggested code does not work for me.
> I have attached the code with the your and Liam's
> modification below.
> 
> 
> In Linux backend fltk works, but when running the code again
> I obtain
> 
> 
> ,----
> 
> | 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/newc
> | ode.m at line 15, column 13
> 
> `----
> 
> In windows where I also have 3.2.4 installed the same errors
> appears. It seems that 3.4. Is not available as precompiled
> binaries, neither for Linux nor for Windows. Am I correct?
> 
> Uwe
> 
> ,----
> 
> | [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);
> |      hpatch = patch(fv);
> |      isonormals(x,y,z,Psi,hpatch);
> | 
> | %     Alphalevel=0.2+0.8*i/n;
> | 
> |      set(hpatch,'FaceColor',color(i,:),'EdgeColor','black')
> | 
> | %      
> | set(hpatch,'FaceAlpha',Alphalevel,'FaceColor',color(i,:),'EdgeColor','no
> | ne') %       set(hpatch,'FaceColor',color(i,:),'EdgeColor','none')
> | 
> |       daspect([1,1,1])
> |       view(3);
> |       axis tight
> |  
> |  %     camlight left;
> |  end
> 
> `----

3.4 is available as binary for linux dependant on the distribution you have 
(in openSUSE for example there are prebuilt rpm's for quite a while now and I 
think I have seen that a packgae for debian is on its way or maybe it is 
already available, but I compile it anyway myself on linux, since it is easy 
on windows it seems to be a major pain to compile it yourself).

It is not completely clear what does not work for you, if it is only the 
original problem with the degenerated triangulation for the maximum value you 
have two choices changing the loop is sufficient.

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

 tested with octave 3.4.2 on openSUSE 11.3 64bit.


reply via email to

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