ATMS 552: Objective Analysis Winter
Homework #4: SVD with Matlab Due Friday January 31, 2014
1.) Use Matlab or some other canned routine set on a workstation
to calculate all of the major subspaces of the following two 3 x 3 matrices
using SVD. Discuss.
a) A = [ 1 3 1 ; 1 2 1 ; 1 1 3 ]
b) B = [ 1 3 1 ; 2 6 2 ; 2 2 6 ]
2.) I have constructed two data sets for you to analyze. You go to the web site ftp://eos.atmos.washington.edu/pub/dennis/552_Class
You can also get them by anonymous ftp to 'ftp.atmos.washington.edu'. Use name = anonymous and type in your email address as a password. Then change directory to cd pub/dennis/552_Class/.
Get the text files x552a.dat and x552b.dat and put them in your working directory.
Now you
are ready to start matlab. Once matlab is up you can ingest the
data files by typing 'load x552a.dat' and this will give you the
data as a matrix called x552a. Now you can SVD this matrix. This
blows a bunch of stuff onto the screen. Be sure you use the method
'[u,s,v]=svd(x552a,0)' so you don't get the null spaces printed, and end the command with a semi-colon if you don't want the results printed on your screen.
The matrices are 512x32, think of the long dimension as time and
the short dimension as space. I arranged the matrices so that
the longer column vectors print out first, and the spatial vectors
will be at the end of the screen dump. You will want to plot
the eof's, pc's and the singular values. You can do this using
the command 'plot(v(:,1:4))', which plots the first 4 columns
of v (or substitute u), and you can plot the singular values using
'plot(s)'. It will be helpful to first type "sd=diag(s);" to put the singular values along the
diagonal of the matrix s into the vector sd and plot that. Then later you can plot the
uncertainty in the eigenvalues, once you figure out how to compute them from the singular values.
Matlab will put the spatial(dimension 32) structures
into V and the temporal structures into U, if you do it the way I
describe here. The data may be arranged as the transpose
of the way we talked about it in class, but you can easily deal with this, right?
The shorter dimension is structure and
the longer dimension is sampling dimension.
To print a copy of one of these graphs type 'print'
while it is in the plot window. I think that's all you really
need to know, unless you want to label the plots, which is probably
a good idea. After you type a command Matlab prints the answer on the
screen by default. To avoid this, end your commands with a semincolon ;.
Note: You can find a description of all the Matlab functions at the following web site. http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.shtml
a) Evaluate the statistical significance of the singular values using the North method and discuss. OK, to do this you need to estimate the true number of degrees of freedom in the sample. Here is a little help file for doing this, with an example. You will need to ftp the auto.m function from my public ftp site, same place the data are. Or you can use the autocorrelation function supplied by Matlab, as long as you understand it. http://www.mathworks.com/help/toolbox/signal/ref/xcorr.html Look at the first example on this help page. You will need the signal processing toolbox, I think.
You can also get lots of my Matlab software at Matlab Example Software for Fun and Homework!
hw45.m is my code to do the requested analysis of x552a and x552b. If you use this software, then your interpretation should be good.
b) Interpret the dominant structures that you derive. Be sure
to look at both the spatial structure(eof) and the corresponding
temporal structure(pc time series). Discuss.
c) Compare and contrast the two data sets. Hint: One is red
noise and the other is red noise plus some other stuff, which
you are supposed to identify. Apply any other logical or statistical
tests you can think of to make sense of these data sets. Describe
in words what you think I did to make data sets a and b.
d) Put your results in a little report, and include relevant
figures and statistical analysis.
END