[Scilab-users] Circular contour plot

Jens Simon Strom j.s.strom at hslmg.de
Fri Apr 29 15:35:33 CEST 2016


Hallo Rafael,
your script is perfect, mine isn't. Where is the bug?
Regards,
Jens


clc(),  clear(),  mode(0),lines(0)    
R=1.;  //Radius Erde
a=50;//Abstand Mond - Erde
g0=1;  //Schwerebeschleunigung des Mondes im Zentrum der Erde
VLev=[-0.02:0.002:0.02];  //Werte der Äquipotenziallinien-Kandidaten
n=400;//Anzahl der x- und y-Werte

xdel();
cmap=zeros(100,3);  //Colormap
f  =  scf();   f.color_map  =  cmap;  
x=linspace(a-R,a+R,n);    y=linspace(-R,R,n);  //Erdgebiet
[X,Y]=ndgrid(x,y);
pos=find((X-a).^2+Y.^2  >  R^2);
X(pos)=%nan;  Y(pos)=%nan;
V=-g0*(X+a^2../sqrt(X.^2+Y.^2)-2*a);
philev=contour2d(x,y,V,  VLev)//Plot und dargestellte Äquipotenziallinien
ca=gca();
ca.isoview="on";
xset("fpf","  ")  //Keine Levelanzeige, Reaktion erst nach dem 2. Lauf

-----------------------------------------------------------------------------------------------------------------------------


Am 29.04.2016 14:24, schrieb Rafael Guerra:
>
> Hello,
>
> Is the following example ok?
>
> t=-%pi:0.02:%pi;
>
> M=sin(t)'*cos(t);
>
> n=length(t);
>
> r=2;///radius/
>
> fori=1:n
>
> forj=1:n
>
> ifsqrt(t(i)^2+t(j)^2)>rthenM(i,j)=%nan;end
>
> end
>
> end
>
> _clf_();
>
> _Sgrayplot_(t,t,M);
>
> Otherwise, could you provide a sample of your pb script.
>
> Regards,
>
> Rafael
>
> *From:*users [mailto:users-bounces at lists.scilab.org] *On Behalf Of 
> *Jens Simon Strom
> *Sent:* Friday, April 29, 2016 1:00 PM
> *To:* International users mailing list for Scilab. 
> <users at lists.scilab.org>
> *Subject:* [Scilab-users] Circular contour plot
>
> Hallo Scilab afficionados,
> I would like to cut off all lines of a 2D contour plot which are 
> outside of a circle. I tried to set all external x and y  to %nan. 
> This works however partially spoils the plot /inside/ the circle too. 
> Polar organisation of the x-y-points doesn't help either because x and 
> y have to be monotone. Could anyone give me a hint how to proceed here?
> Kind Regards
> Jens
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160429/b908c13c/attachment.htm>


More information about the users mailing list