Labs and homeworks should be produced as follows
diary
function to keep a plain-text diary of your Matlab session.format compact
to reduce whitespace.Here's an example of a decently documented and formatted plain-text lab for turning in.
>> % John Gibson >> % Lab #3, 9/18/2012 >> % Math 445 >> % Problem 1: >> % Show e^a e^b == e^(a+b) for a=0.3, b=0.4 >> format long >> a=0.3; b=0.4; >> e^a * e^b ans = 2.01375270747048 >> e^(a+b) ans = 2.01375270747048 >> % Show (e^a)^b == e^(ab) for a=0.3, b=0.4 >> a=0.2; b=10; >> (e^a)^b ans = 7.38905609893065 >> e^(a*b) ans = 7.38905609893065 >> % Problem 2: Evaluate 0 < 5 < 2 in Matlab and explain the result. >> 0 < 5 < 2 ans = 1 >> % For the expression 0 < 5 < 2, Matlab returns 1 because... >> % the first comparison 0 < 5 is a logical expression that evaluates to 1 (true) >> % so 0 < 5 < 2 reduces to 1 < 2, another logical expression that evaluates to 1 (true)