% This is a script for generating 3D surface graphs from an excel table. No
% additional software is required. To generate a graph, place this file in
% the same folder as the Excel table. Next, specify the name of the table
% in the T variable. The first two columns will be the x and y axis.
% Specify which column You wish to plot for the z variable. Next, specify
% the range of values (ylim, zlim) and tick ranges and format and also the
% colormap. Or remove these commands to keep the default settings.

T = readtable('Table_name.xlsx', 'VariableNamingRule','preserve');
Q1 = T(1:25,:);
VarNames = T.Properties.VariableNames; 
x = T{:,1};
y = T{:,2};
z = T{:,6};
[Ux,iax,ixx] = unique(x);
[Uy,iay,ixy] = unique(y);
N = 25;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[Xm,Ym] = ndgrid(xv, yv);
Zm = griddata(x, y, z, Xm, Ym);

figure
surfc(Xm, Ym, Zm)
grid on
xlabel(VarNames{1})
ylabel(VarNames{2})
zlabel(VarNames{6})

set(gca,'Xtick',300:50:600)
set(gca,'Ytick',1.4:0.2:3.2)
ytickformat('%.1f');
zlim([400 500])
ylim([2 3.2])
set(gca,'Ztick',400:20:500)
XTickLabelRotation = -25;
YTickLabelRotation = 25;
colormap jet;


ax = gca;
ax.FontSize = 14;



