proj2 - MATLAB Project 2 for MAS 3114 Due Friday October 14...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MATLAB Project 2 for MAS 3114 Due Friday, October 14 Input the function file lead.m given below into your MATLAB directory: function L=lead(A) [m,n]=size(A); R=rref(A); L=logical(zeros(1,n)); row=1; col=1; while col<=n & row<=m, if R(row,col)==1, L(col)=1; row=row+1; end col=col+1; end 1. Apply lead to the following matrices: (a) A=[1 2 0 4 0 3; 9 18 3 54 0 12; 9 18 0 36 1 20; 3 6 1 18 0 4]. (b) B=rand(4,6). (c) C=vander(1:5). (d) D=magic(8). Describe what lead(M) is for an arbitrary matrix M. (Hint: Compare lead(M) with rref(M).) 2. Use lead(A) to write a function v=nullrank(A) whose output is a 1 × 2 matrix v such that v(1,1) is the number of pivot variables in the solution to Ax = 0, and v(1,2) is the number of free variables in the solution to Ax = 0. Your file nullrank.m should not use the MATLAB functions rank or null. Apply nullrank to the matrices in problem 1 above. 3. Use the MATLAB function rref and the function lead above to write a MATLAB function N=nullbase(A) which computes a matrix N whose columns form a basis for the nullspace of A. Your file nullbase.m should not use the MATLAB functions rank or null. Compute nullbase(A) and nullbase(A’*A) for the matrices given in problem 1 above. Make a reasonable conjecture based on these computations. MATLAB has some methods for constructing matrices which you may find useful. For instance, B=A(:,[1,5,4]) creates a matrix B whose columns are the 1st, 5th, and 4th columns of A. If the second input is a vector with the “logical” data type then MATLAB interprets it differently: If A has 6 columns then A(:,[0,1,0,0,1,1]) is a matrix whose columns are the 2nd, 5th, and 6th columns of A. ...
View Full Document

This note was uploaded on 12/27/2011 for the course MAS 3114 taught by Professor Olson during the Fall '08 term at University of Florida.

Ask a homework question - tutors are online