Matlab Output

If you put all your code in a .m file then instead of printing out what you typed into the Matlab terminal, you can use Matlab's publish option. Using Publish:

The published file should be an html file by default. It will include all your code and the output in one file. If you want to change the format of the file, you will need to change your configurations. If you want to figure out how to give your published file special formatting like headers, titles, lists, comments, etc. look at Matlab's help feature.

There are always things that need to be included in a project submission:

The matlab code must be submitted as a in one of the following formats:

An Example of Types of Files

Suppose we were asked to find the LU factorization of some matrices A and B using Matlab.

You could type all your code in the command line, write down what you found for L and U, and copy the codes you used in a text file. Then print out the text file and attach it to your project packet. This is perfectly acceptable, and for those of you with limited computer experience or are feeling like matlab hates you, I would reccomend this approach.

There is another (prefered) option:
You could write a Matlab function that takes in a matrix and then displays the L and U of the LU factorization and/or you could put all your code into a script file and making sure there are no semicolons at the ends of the lines, you could publish this script. See below for example:

Notice here that publishing a .m file makes it look really nice; however, you'll only get good results if
(a) you don't put semicolons at the end of the lines -- this means the output of those lines will be displayed in the published file
(b) you put comments in between the various sections

Another Example of Publishing an .m File

Suppose you want to write a Matlab function that solves Ux=b for x and only displays x at the end. The following is a test script for such a function, where U is a random matrix and b is built such that all the entries of x will be 1's.