[scilab-Users] A red point in plot3d

harishankar ramachandran hsr at ee.iitm.ac.in
Mon May 18 06:14:58 CEST 2009


I don't see any option to place a mark at (x,y,z) of a 3-D plot. There is 
xpoly, but that works for 2-D plots. Others may be able to suggest something.

I suspect you need to go into plot3d and determine how (x,y,z) is mapped into 
(x0,y0) on the graph. Once you know that, you can use any draw primitive and 
place whatever you like at that point. One problem will be the handling of 
hidden lines. Suppose your red point is not visible for the given theta, 
alpha, should it still be drawn? How do we find out if it is hidden or not?

The first part of your code is not efficient. Better to code it as follows:

x=[-1:0.01:1]';
y=[-1:0.01:1];
g = (x .* sin(4*%pi*x))*ones(y) - ones(x)*(y .* sin(4*%pi*y+%pi)) + 1;
plot3d(x,y,g)

Avoid for loops whenever possible.

regards

hari ramachandran


On Sunday 17 May 2009 23:56, Lucio Agostinho Rocha wrote:
> Hi,
>
> To finish my work, I want to put some red points in this function:
>
>    x=[-1:0.01:1];
>    y=[-1:0.01:1];
>
>    for i=1:length(x)
>       for j=1:length(y)
>          g(i,j) = x(i) .* sin((4*%pi) * x(i)) - y(j) .* sin ( (4*%pi) * 
> y(j) + %pi ) + 1; end
>    end
>
> Then, I tried to insert a new position in each list, like this:
>
>    tx=length(x)+1;
>    ty=length(y)+1;
>    x(1,tx)=2;
>    y(1,ty)=1;
>    g(tx,ty)= x(tx) .* sin((4*%pi) * x(tx)) - y(ty) .* sin ( (4*%pi) * 
> y(ty) + %pi ) + 1;
>
>    plot3d(x,y,g)
>
> But this don't work. I've several values for x and y like '0.8987...' and
> '-0.321...'. How can I plot this points in my function? Some suggestion?
>
> Thanks in advance,
>
> Lucio
> ........
>
>
>       Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com

-- 
Dr. Hari Ramachandran, Professor, 332B ESB, EE Dept, IIT-Madras
Interests: Nonlinear Optics, Nonlinear Waves, Plasma Physics, Particle 
           Simulations, Computational Algorithms, Linux.
Off: 91-44-2257-4421                    Fax: 91-44-2257-0120
Res: 91-44-2663-1863             Home Email: omkarbharathi at gmail.com



More information about the users mailing list