필터 지우기
필터 지우기

Plotting a function of 3 variables ?

조회 수: 7 (최근 30일)
Usjes
Usjes 2012년 4월 25일
Hi,
I'm trying to visualize a function of 3 variables v = f(x,y,z). So I'm wondering is there any appropriate plotting function in Matlab? What I am thinking of is a 3-D lattice of markers with the colour of the marker indicating the function value, like a 3-D scatter plot with each point being a different coloured sphere with the colour indicating the function's magnitude at that point. The spheres would be small relative to the distance between adjacent spheres (the x,y,z coordinates to be plotted will be uniformly spaced) so that the figure could be rotated and viewed from all angles while still being able to see any patterns or trends through the entire lattice. Is there any command to achieve something like this ?
Thanks

답변 (3개)

Walter Roberson
Walter Roberson 2012년 4월 25일
spheresize = 10;
scatter3(x, y, z, spheresize, v)

Eric
Eric 2012년 4월 25일
See the documentation for scatter3. http://www.mathworks.com/help/techdoc/ref/scatter3.html) The last input argument lets you pass color information for each point. I've successfully used the two-dimensional version of this function in the manner you describe.
Use either the icons on the figure window to zoom and rotate or use the zoom and rotate3d commanders from the command line.
Good luck,
Eric

julie
julie 2013년 5월 2일
I need to do the same kind of thing. How do you do to make the color parameter of scatter3 take the value of your function v or to associate this value to a RGB row vector?
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 5월 2일
As I indicated above,
spheresize = 10;
scatter3(x, y, z, spheresize, v)
The 5th parameter, v, is the position for color. It may be a column vector the same length as x, or it may be an RGB array, v(K,:) corresponding to x(K), y(K), z(K)
julie
julie 2013년 5월 3일
Thanks! that's OK, I thought the function accept only RGB vector.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by