
This may be accomplished by a pair of commands like The first task to to make the grid to be used. Note that commands below are typed into the Command Window. For this tutorial, we will assume you have a vector with distance east called Easting, a vector with distance north called Northing and a vector of data to contour called myData. Thus it is preferable that you have imported data with a Northing and Easting of some kind rather than Latitude and Longitude, though you can work with either. In gridding, you want to have a grid that is uniformly spaced in X and Y. Ideally you would not do this, but while there is a delaunay command in Matlab, it assigns colors to triangles in unsatisfactory fashion.

(If you do not have the create vectors option, there is probably a mismatch somewhere because of some text down in the number, you are missing column headers or there is a blank cell or something like that). In the second screen (after hitting "Next >") you should have the option to "Create vectors from each column using column names."-select this option. You should see that there is data, textdata, and colheaders in the preview if all is right. Matlab will probably correctly figure out the number of text lines at the start and the delimiter (comma or tab) used in the file, but if not, correct that in the first screen. After launching Matlab, choose "Import Data." (typically in the File menu). Note that some particulars vary between versions of Matlab this is referring to 2009b on a Mac. This should be straightforward if your file is clean. Export the data as either a comma delimited (csv) or tab-delimted text file. You need to leave a set of labels at the top of the file (though remove spaces from these also to avoid trouble later on these will become your variable names).

Ideally rows or columns with blank values should be dropped or something filled in. Matlab has the nasty tendency to decide that you cannot import columns as vectors if there is anything odd in text, so it is best to avoid. Generating the input file:Īssuming you are in Excel with columns for latitude (or northing) and longitude (or easting) and the data you wish to contour (e.g., complete Bouguer anomaly, elevation, etc.), you first want to strip out any text columns (e.g., station names).

To make a regular contour plot, you will first need to make a file that will import smoothly into Matlab, then resample the data to a uniform grid, and then make your contour map. If you plan to do a lot of mapping, learning GMT is probably worthwhile).Īn overview of using Matlab for geological applications in general is at ASU.
#Gridded interpolation matlab install#
GMT (Generic Mapping Tools) will do this well and is free, but a command-line Unix package that can be challenging to understand and install iGMT helps but again is not the easiest thing to install. (Some other packages such as Aabel and Surfer will contour irregular data much more faithfully, but we lack these packages on lab computers. Sadly, it is awkward in the way that it will contour irregularly spaced data. It is one of the packages we have on the computers in Benson (and it is also on many of the Engineering labs).
#Gridded interpolation matlab software#
One of the all-purpose software packages for numerical analysis of data is Matlab. GEOL4714/5714: Contouring in Matlab Making a contour plot/map in Matlab
