Plotting two sets of 3D points on same graph

14 ビュー (過去 30 日間)
Andrew Dickinson
Andrew Dickinson 2019 年 3 月 25 日
コメント済み: Andrew Dickinson 2019 年 3 月 26 日
If I have a data set consiting of two sets of X, Y, and Z values. The data is collected by two sensors at the same time.
IS it possible to map both sets of points (X,Y,Z) on the same graph and distinguish the sets by colour?
How would I go about grating such a graph?

回答 (2 件)

Kevin Phung
Kevin Phung 2019 年 3 月 25 日
編集済み: Kevin Phung 2019 年 3 月 25 日
You can plot multiple points on a graph by using the
hold on
function. take a look:
heres an example with different colors:
x= 1:5
y= 1:5
y2 = 5:-1:1
figure
plot(x,y,'r') % you can use character codes to specific color.. like 'r' for red, ' b' for blue
hold on
plot(x,y2,'Color',[0 1 0]) %or by assinging RBG values to the color property of a line.
instead of the hold on, you can also plot multiple sets with the plot function:
plot(x,y,'r',x2,y2,'b')
  1 件のコメント
Andrew Dickinson
Andrew Dickinson 2019 年 3 月 26 日
Thank you for the information will try

サインインしてコメントする。


Mauro Fusco
Mauro Fusco 2019 年 3 月 25 日
Hi,
you can use, for example, mesh to make two surfaces representing Z values over the X,Y grid. For example (assuming X,Y , and computing Z1 and Z2 for making the example):
x = 0:0.1:1; % x values
y = 0:0.1:4; % y values
[X,Y] = meshgrid(x,y); %build a grid
Z1 = sin(X)+cos(Y); % simulated z1 values
Z2 = X.^2 - Y.^2; %simulated z2 values
figure;
m1 = mesh(Z1); %plot surface sensor 1
m1.FaceColor = 'red'; %select color
hold on;
m2 = mesh(Z2); %plot surface sensor 2
m2.FaceColor = 'blue'; %select color
surfaces.PNG
  1 件のコメント
Andrew Dickinson
Andrew Dickinson 2019 年 3 月 26 日
Thank you for this option will try it

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by