3D plot from excel

3 次查看(过去 30 天)
I have a file excel with x,y coordinates and stresses for z coordinate in order to plot a 3D surface.
How can I get this surface with latex interpreter and colorbar?
I attach the excel file.
Thanks

采纳的回答

Star Strider
Star Strider 2021-5-13
Try something like this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/616758/Shear%20stress%20adhesive.xlsx', 'VariableNamingRule','preserve');
% First10Rows = T1(1:10,:)
T1Sz = size(T1)
T1Sz = 1×2
69696 3
VarNames = T1.Properties.VariableNames;
N = 50; % Interpolation Matrix Size
xv = linspace(min(T1{:,1}), max(T1{:,1}), N); % Create Vector
yv = linspace(min(T1{:,2}), max(T1{:,2}), N); % Create Vector
[Xm,Ym] = ndgrid(xv,yv); % Create Interpolation Matrices
Zm = griddata(T1{:,1}, T1{:,2}, T1{:,3}, Xm, Ym); % Interpolate
Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.
figure
surfc(Xm, Ym, Zm)
grid on
hcb = colorbar;
hcb.TickLabelInterpreter='latex';
xlabel(VarNames{1}, 'Interpreter','latex')
ylabel(VarNames{2}, 'Interpreter','latex')
zlabel(VarNames{3}, 'Interpreter','latex')
Experiment to get different results.
.
  7 个评论
Francesco Marchione
Thank you so much
Star Strider
Star Strider 2021-5-14
As always, my pleasure!

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by