% Assignment7 % % Script to plot topographic data of a section of the San Andreas fault % using several different types of plot. The script will read % irregularly-spaced elevation data, and call a set of functions that will % interpolate that data to a grid, and plot it. % % Author: Robert Wagner % Date: 2nd March 2009 % Last Modified: 12th March 2009 clear % Read the data into a set of arrays for easting, northing, and elevation. data = load('vmrrot2.txt'); E = data(:,1); N = data(:,2); H = data(:,3); % Set up variables for the spacing of grid dat points. gridSize = 10; numBlocks = 10; contourInterval = 3; % Plot the raw data. set_up_figure(1, 'Locations of data points', 'Easting(m)', 'Northing(m)'); plot_data(E, N); print('assign7_elev_raw.png','-dpng') % Display the trangle-mesh used for interpolation. set_up_figure(2, 'Triangles for linear interpolation', 'Easting(m)', 'Northing(m)'); triangle_mesh(E, N, H) zlabel('Elevation(m)'); print('assign7_elev_tri.png','-dpng') % Suppress further duplicate point warnings, after the triangle-mesh plot % throws one. Let it be known that this data set contins duplicate points. warning('off', 'MATLAB:griddata:DuplicateDataPoints'); warning('off', 'MATLAB:delaunayn:DuplicateDataPoints'); % Contour map, with markers showing where the grid points are. set_up_figure(3, 'Contour map of elevation data, with grid markers', 'Easting(m)', 'Northing(m)'); grid_contour(E, N, H, numBlocks, numBlocks, contourInterval, 1) print('assign7_elev_contour_grid.png','-dpng') % Contour map, with no grid markers. set_up_figure(4, 'Contour map of elevation data', 'Easting(m)', 'Northing(m)'); basic_contour(E, N, H, numBlocks, numBlocks, contourInterval, 1) print('assign7_elev_contour.png','-dpng') % Scaled image of elevation. set_up_figure(5, 'Color plot of elevation data', 'Easting(m)', 'Northing(m)'); scaled_image(E, N, H, gridSize, gridSize, 0) print('assign7_elev_colormap.png','-dpng') % 3D plot of the landscape, rotated to a decent-looking orientation. set_up_figure(6, '3D map of elevation data', 'Easting(m)', 'Northing(m)'); plot_surface(E, N, H, gridSize, gridSize, 0) zlabel('Elevation(m)'); view(-92,46); print('assign7_elev_3d.png','-dpng') % Restore duplicate point warnings, now that the script is done. warning('on', 'MATLAB:griddata:DuplicateDataPoints'); warning('on', 'MATLAB:delaunayn:DuplicateDataPoints');