surface3d from a three column matrix ??

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

surface3d from a three column matrix ??

skan
This post has NOT been accepted by the mailing list yet.
Hello

imagine I have a 3 colums matrix
x, y, z where z is a function of x and y.

I know how to plot a "scatter plot" of these points with rgl's   plot3d(x,y,z)

But if I want a surface instead I must use other commands such as surface3d The problem there is that it doesn't accept the same inputs as plot3d, it seems to need a matrix with
(nÂș elements of z) = (n of elements of x) * (n of elements of x)

How can I get this matrix? I've tried with the command interp, as I do when I need to use contour plots.

How can I plot a surface directly from x,y,z without calculating this matrix? If I had too many points this matrix would be too big.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: surface3d from a three column matrix ??

Arun.stat
Hi Skan, are you looking for persp() function?

Regards,
Reply | Threaded
Open this post in threaded view
|

Re: surface3d from a three column matrix ??

skan
This post has NOT been accepted by the mailing list yet.
Hello

If I write plot3d(tmp[,2],tmp[,3],tmp[,1])  I get a 3D scatter plot but I need a surface.

If I use  persp(tmp[,2],tmp[,3],tmp[,1])  I get this error message
increasing 'x' and 'y' values expected