Homework 1∗†CS 525The data for this problem, namelyA =1 2 63 4 5, B =1 3 54 1 81 1 1, C =4 1 −31 −1 1,x =1340−21, y =121523, z =121, α = 3,can be loaded from hwk1.mat by issuing within MATLAB the load hwk1command as indicated below. Make sure you print out a diary file containingyour MATLAB session as explained in the one-page MATLAB Setup classhandout, also available on the web at: http://www.cs.wisc.edu/∼cs525-1. diary hwk1.lst %hwk1.lastname.initial load hwk1 who . . .∗Each homework is due at the beginning of class one week after assigned. No latehomework accepted.†You may wish to refer to CS525 Handout 2, “MATLAB Primer”, available from DoItfor details about MATLAB for this assignment.1 . . . . . . clear %end hwk1 diary offEvaluate the following in MATLAB. More credit will be given for shorteranswers.1. A + αC2. AB3. v, where vi= xi/yi4. mini=1,2,... ,6xi(help min)5. w = (x2, x4, x1, x3, x5, x6) (row vector)6. Write a MATLAB m-file “hw1run” that carries out the following steps:• Clear the workspace of all variables• Loads the data from hwk1.mat• Calculates D = C0A + B• Calculates an LU decompostition of D (help lu).• Extracts the diagonal of U into a vector d (help diag).• Sums up all the elements of d and prints out the result with atleast 10 figures of accuracy (help format).Make sure that your diary file contains the lines: type hw1run.m; hw1runThese commands list and execute your m-file “hw1run”,
View Full Document