3D plot help

2 ビュー (過去 30 日間)
laurent jalabert
laurent jalabert 2018 年 7 月 30 日
コメント済み: laurent jalabert 2018 年 7 月 30 日
Dear all, I am sorry for this basic question, but even I have some experience with matlab, I am not able to understand why I cannot display a 3D graph with a set of data X,Y,Z below.
X = (1:1:5)'; % column vector of Param 1
Y = (1:1:10)'; % column vector of Param 2
Z = sin((1:1:50))'; % example of 1D data, but in real case it is point by point (not a function like sin(x,y), cos or any).
shape_Z = reshape(Z, length(X), length(Y));% in 2D representation
I have 1D x-axis parameter, 1D y-axis parameter, and Z is also 1D listing the associated data. In fact Z is reshaped to shape_Z in 2D to have a better understanding of the value for each (X,Y) parameters, as it is not intuitive with Z in 1D.
  2 件のコメント
madhan ravi
madhan ravi 2018 年 7 月 30 日
編集済み: madhan ravi 2018 年 7 月 30 日
It’s because they are independent of each other, it means it’s three dimensional arguments in 4 dimensional space and matlab is only capable of 3 dimensional space.
laurent jalabert
laurent jalabert 2018 年 7 月 30 日
... yes, you are right but please try this :
X = (-1:1:5)'; sx = size(X)
Y = (-1:1:10)'; sy = size(Y)
Z = sin((0:1:sx(1)*sy(1)-1))'; size(Z)
shape_Z = reshape(Z, length(X), length(Y)); size(shape_Z)
surf(shape_Z)
alpha 0.5

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

採用された回答

KSSV
KSSV 2018 年 7 月 30 日
X = (1:1:5)'; % column vector of Param 1
Y = (1:1:10)'; % column vector of Param 2
Z = sin((1:1:50))'; % example of 1D data, but in real case it is point by point (not a function like sin(x,y), cos or any).
shape_Z = reshape(Z, length(X), length(Y));% in 2D representation
surf(X,Y,shape_Z')
shading interp

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by