# GLG410 Matlab

For this lab, I hope that you will become comfortable with the basics of
operating Matlab.

Tasks
## Tasks

- Work through the examples in

Using Matlab For Geological
Applications
- Download and view Professor Rankin's Matlab Guide:

http://www.eas.asu.edu/~rankin/resources/MatLabRev.pdf
once you save it to your directory, you will need to type:
`darkwing% acroread &`

that will launch the Adobe Acrobat Reader and then you can open the Matlab
guide
- Read and work through Chapter 1 of Middleton.

A couple of points:

a) you can copy the files from the diskette from my directory on
darkwing:

/export/home2/ramon/glg410matlab/middleton_files. You may want to upload
the necessary documents directly to your directory. Keep your home
directory neat and organized!

b) to make the sample function work (HIST2.M), you have to change its name
to hist2.m. do that at the Matlab prompt this way:
`>> !mv HIST2.M hist2.m`

The exclamation point tells Matlab to send the command to the UNIX shell.
- Look at the seismicity for the Oaxaca trench from
this page.

a) Convert that web page to vectors in Matlab for longitude, latitude,
depth, magnitude.

b) Make the following plots (without the points connected:

longitude versus latitude (map of the locations)

Divide the depth and magnitude ranges into a series of meaningful class
intervals (see page 7 of middleton), and plot a histogram of magnitude
and of depth.

c) determine the mean, max, min, and standard deviation of the depths
and magnitudes.

d) use the diary function to capture the outputs of the calculations
for c into a file.

e)Make a simple web page with *.gifs of the plots and incorporate the
history file from part d that explains your examination of the
spatial and magnitude distribution of the seismicity in the area of
Oaxaca. Write a one paragraph explanation of the results.

f) email the url to jwsutter@hotmail.com and ramon.arrowsmith@asu.edu
by the beginning of lab on Novembe 16, 1999.

## Demo for bringing data into MatLab

Let's take this dataset for flow rate in cubic feet per second versus time
of the Salt River at Priest Road from the USGS (http://water.usgs.gov).

How to get it into MatLab?

- Save the file from the broswer to the local hard disk.
- Import into excel into separate columns.
- Copy each column one at a time to a separate Excel file and save
them as txt format.
- Upload the individual files to darkwing
- Type >>load to load each into a vector of that filename.
- You can plot it, as well as determine parameters such as MAX,
MIN, MEAN, Median, and Standard Deviation (STD) for the data. Here is
a link that shows how I processed those data.

Pages maintained by

Prof. Ramón Arrowsmith

Last modified November 9, 1999