How to visualize the function R ^ 3 & # 8594; R in Matlab?

I have a function that assigns a real value to each point in space. How can I visualize it on a limited volume?

+7
source share
1 answer

To expand Peter's suggestion in the comments ^^:

use scatter3 with cdata parameter cdata :

 % generating some sample data [x,y,z]=sphere(50); x=x(:);y=y(:);z=z(:); % the interesting stuff: h=scatter3(x,y,z); 

gives you

scatter3

To add coloring, do the following:

 set(h,'cdata',z) 

or immediately:

 scatter3(x,y,z,'cdata',z); 

that leads to

enter image description here

Here the color vector is just the value of z, but it can be anything (as long as it has the same size as x (and y and z).

+4
source

All Articles