MATLAB Examples

book_4_69.m

Surface plot with lighting

load soil

% Reduce the amount of data for faster computation.
factor = 1;
Easting = Easting(1:factor:end);
Northing = Northing(1:factor:end);
Resistivity = Resistivity(1:factor:end);

%  loess parameters
alpha = 0.1;
lambda = 3;

% Smooth and grid the data.
XI = 0.15:0.05:1.41;
YI = (0.15:0.05:3.645)';
nx = length(XI);
ny = length(YI);
newx = repmat(XI,ny,1);
newy = repmat(YI,1,nx);
newz = loess2(Easting,Northing,Resistivity,newx,newy,alpha,lambda);

% Set perspective and lighting.
az = 5;
el = 30;
s = [-90 60];
cla
hold on
view(az,el)

% Make surface plot with lighting.
surfl(newx,newy,newz,s);
hold off
set(gca,'Projection','perspective')
shading interp
colormap(gray)
xlabel('Easting (km)')
ylabel('Northing (km)')
title('Soil')