How to Plot 3D surface
20 次查看(过去 30 天)
显示 更早的评论
hello I have excel sheel has three columns, xyz, I wanna import the data and plot z(surface) based on the mesh xy. how can I do it? I tried to write a code as in pic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% excel sheet has 3 columns as below
% x Y z
% - - -
% - - -
% - - -
% - - -
% how to plot Z as surfece on mesh XY ?
%
%********** IMPORT FILE FROM XLS SHEET***************%
filename = 'num.xlsx';
sheet = 1;
xlRange = 'A1:B1:C100';%%we can use another column insted of C
subsetA = xlsread(filename, sheet, xlRange);
%%ZZ=reshape(subsetA(:,100),100,100) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[X,Y] = meshgrid(0:0.15:20,0:0.15:20); Z=reshape(X,Y,Z); %H = h.reshape(10,1); surf(X,Y,Z) %%%%%%%%%%%%%%%%%%%%%%%%
thx
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!