请问已知xyz的值能用matlab绘制一个散点图吗
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 16:42:28
请问已知xyz的值能用matlab绘制一个散点图吗
请问已知xyz的值能用matlab绘制一个散点图吗
请问已知xyz的值能用matlab绘制一个散点图吗
>> help scatter3
SCATTER3 3-D Scatter plot.
SCATTER3(X,Y,Z,S,C) displays colored circles at the locations
specified by the vectors X,Y,Z (which must all be the same size).The
area of each marker is determined by the values in the vector S (in
points^2) and the colors of each marker are based on the values in C.S
can be a scalar,in which case all the markers are drawn the same
size,or a vector the same length as X,Y,and Z.
When C is a vector the same length as X,Y,and Z,the values in C
are linearly mapped to the colors in the current colormap.
When C is a LENGTH(X)-by-3 matrix,the values in C specify the
colors of the markers as RGB values.C can also be a color string.
SCATTER3(X,Y,Z) draws the markers with the default size and color.
SCATTER3(X,Y,Z,S) draws the markers with a single color.
SCATTER3(...,M) uses the marker M instead of 'o'.
SCATTER3(...,'filled') fills the markers.
SCATTER3(AX,...) plots into AX instead of GCA.
H = SCATTER3(...) returns handles to scatter objects created.
Use PLOT3 for single color,single marker size 3-D scatter plots.
Example
[x,y,z] = sphere(16);
X = [x(:)*.5 x(:)*.75 x(:)];
Y = [y(:)*.5 y(:)*.75 y(:)];
Z = [z(:)*.5 z(:)*.75 z(:)];
S = repmat([1 .75 .5]*10,numel(x),1);
C = repmat([1 2 3],numel(x),1);
scatter3(X(:),Y(:),Z(:),S(:),C(:),'filled'),view(-60,60)
See also scatter,plot3.
可以的,画出来的是三维的散点图,参见scatter3