How can I plot 2 matrices in the same 3D plot using surf or mesh?

29 ビュー (過去 30 日間)
Poorva Limaye
Poorva Limaye 2017 年 2 月 6 日
回答済み: Faiz Gouri 2017 年 2 月 10 日
Like in 2D plot we can use plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn) How can I plot multiple matrices in the same 3D plot?
  2 件のコメント
John Chilleri
John Chilleri 2017 年 2 月 6 日
plot3 is the the 3d version of plot, perhaps this will be of use!
KSSV
KSSV 2017 年 2 月 7 日
Use hold on and plot use surf twice..

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

回答 (1 件)

Faiz Gouri
Faiz Gouri 2017 年 2 月 10 日
It is my understanding that you would like to use surf/mesh to plot in 3D for multiple matrices in the same figure, just like plot(x1,y1,x2,y2,...) is used to plot() to plot a 2D plot for multiple matrices in the same figure.
You can use "hold on" to retain current plot when adding new plots. The following example will illustrate how to achieve the above:
[X1,Y1] = meshgrid(-10:.5:10);
R1 = sqrt(X1.^2 + Y1.^2) + eps;
Z1 = sin(R1)./R1;
[X2,Y2] = meshgrid(-5:.5:5);
R2 = sqrt(X2.^2 + Y2.^2) + eps;
Z2 = sin(R2)./R2;
m = surf(Z1)
hold on
surf(Z2)
Refer the Hold documentation for more information on how to use hold

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by