User Tools

Site Tools


gibson:teaching:spring-2015:math445:examplelab

What to turn in for a lab or homework

Labs and homeworks should be produced as follows

  1. Use Matlab's diary function to keep a plain-text diary of your Matlab session.
  2. Use format compact to reduce whitespace.
  3. Work out the problems in Matlab
  4. If any questions require answer written out in English, type them as comments in the Matlab session
  5. When your Matlab session is over, edit the diary with a plain-text editor to remove mistakes and generally make the dairy clean and easily readable.
  6. Please do not cut and paste your Matlab work into a Microsoft Word document or similar.
  7. Either print out the diary or email it to the Teaching Assistant, depending on his or her preferences.

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)
gibson/teaching/spring-2015/math445/examplelab.txt · Last modified: 2015/01/19 12:35 by gibson