How to draw a 3D plot from an excel data?

How to draw a 3D plot from an excel data? Please click for downloading following Excel Data (or find attachment)
(maybe mesh 3d plot or surfc plot)
(First column is x-values, first row is y-values.)

 採用された回答

KSSV
KSSV 2021 年 2 月 22 日

1 投票

num = xlsread('test3.xlsx') ;
x = num(2:end,1) ;
y = num(1,2:end) ;
Z = num(2:end,2:end) ;
surf(x,y,Z')

3 件のコメント

student_md
student_md 2021 年 2 月 22 日
Thank you very much @KSSV.
  • How to draw surfc plot?
The following code doesn' t work.
figure (2)
xi = unique(x) ; nx = length(xi) ;
yi = unique(y) ; ny = length(yi) ;
[X,Y] = meshgrid(xi,yi);
surfc(X,Y,Z');
student_md
student_md 2021 年 2 月 22 日
編集済み: student_md 2021 年 2 月 22 日
Dear @KSSV,
Is something wrong in the code?
In fact;
this excel data is values of z=sin(x)*cos(y)
where
x=[-2*Pi, 2*Pi],
y=[-2*Pi, 2*Pi]
KSSV
KSSV 2021 年 2 月 23 日
x=linspace(-2*Pi,2*Pi) ;
y=linspace(-2*Pi,2*Pi) ;
[X,Y] = meshgrid(x,y) ;
Z = sin(x).*cos(y) ; % element by element multiplication
surf(X,Y,Z)

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

その他の回答 (0 件)

質問済み:

2021 年 2 月 22 日

コメント済み:

2021 年 2 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by