How to plot a 3d graph with z axis, not the same length as x,y from, the data is imported from an excel sheet ?

1 次查看(过去 30 天)
I have data from an experiment as attached, how can I import the data from the excel sheet and then build a surface 3-d graph?

回答(1 个)

Dyuman Joshi
Dyuman Joshi 2023-3-28
编辑:Dyuman Joshi 2023-3-28
out=readmatrix('Test1.xlsx')
out = 20×15
NaN 0 1 2 3 4 5 6 7 8 9 10 11 12 13 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1 13 12 11 10 9 8 7 6 5 4 3 2 1 0 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 3 13 12 11 10 9 8 7 6 5 4 3 2 1 0 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 5 13 12 11 10 9 8 7 6 5 4 3 2 1 0 6 0 1 2 3 4 5 6 7 8 9 10 11 12 13 7 13 12 11 10 9 8 7 6 5 4 3 2 1 0 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13
%Extracting x, y and z data
x = out(1,2:end);
y = out(3:end,1);
Z = out(3:end,2:end);
%Create a mesh
[X,Y]=meshgrid(x,y);
%Draw a surface graph
surf(X,Y,Z)
%You can also extract data via readmatrix() and the range of data from excel
x0 = readmatrix('Test1.xlsx','Range','C2:P2')
x0 = 1×14
0 1 2 3 4 5 6 7 8 9 10 11 12 13
%similarly y0 = readmatrix('Test1.xlsx','Range','C4:C21')
%z0 = readmatrix('Test1.xlsx','Range','C4:P21')

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by