AMATH 352
Summer Quarter, 2008
And here's a starter for the code for fullsolve.m
function [x,N] = fullsolve(A,b) % Reduce [A b] using gausselim2. [Aech, bech] = gausselim2(A,b);I can't say much more without giving away the good parts. However, it's worth mentioning that the command isempty will check whether an array is empty.
In particular, if there are no free variables, then
freevars is an empty array, and isempty(freevars)=1.
Otherwise, isempty(freevars)=0. This will probably
be useful for an if statement somewhere along the way.
for i = 10:-1:1 disp(i) endThis loop will display numbers counting down from 10 to 1. The expression 10:-1:1 represents the list of numbers from 10 to 1, changing by -1 each time.
The expression L(i, 1:i-1) * x(1:i-1) on line 34
is a shortcut that calculates the sum
by using matrix multiplication. This avoids using a for loop, as these aren't exactly one of Matlab's strengths.
Problem 1.   Basic LU factorization: Write a Matlab
program that will take an invertible matrix A as input,
and return the factors L and U in a basic
LU factorization.
You can assume the user has entered a matrix with a basic LU factorization, but if you'd rather, you can also have it return an error if there is no such factorization.
Problem 2.   LUP factorization: Write a Matlab program that will take an invertible matrix A as input, and return the factors L, U, and P in an LUP factorization.