Programming in Mathematics

We started the semester doing a brief overview on Matlab. If you have questions or want a review, I recommend that you watch this video or review the class notes. These will give you a brief overview of the commands and how to input data into Matlab. The rest of the first week's lectures will be focused on learning how to publish Matlab files. For a review, I recommend that you watch this video and review Dr. O's documentation. For this class, all your files will be saved on your G-drive. In order for me to find your files, please follow:
  1. On your G-drive, create a directory/folder "www" (if you haven't already done so).
  2. Within the "www" directory/folder, create another directory/folder "loy#" (where # is your student ID number.)
  3. Within that directory/folder, create another directory/folder "MA302" that signifies this class.
  4. Save your m-files (your script and any function files you need) in this directory/folder.
  5. Format your script file in such a way so that it "publishes" nicely (details below)
  6. Once it is saved, within the command window in MATLAB, type
    publish('examplefile.m', 'html')
    Make sure you have the CORRECT "Current Directory" and filename!
  7. You can view your webpage at
    Every published file must have a link to its website and m-file. For example,
    %% Link to this website and m-file
    % * < hw1User.html>
    % * < hw1User.m>
    For more information on Student Webpages click here

Problem Set 1
  • Create an m-file called hw1Last.m where Last is the first four letters of your last name in your MA302 folder. A startup m-file is located here.

  • For the first problem, create a sample grade sheet for 4 people with 5 assignments.
    1. Change the second person's homework 3 grade to a 100.
    2. Curve everyone's homework 2 grade up by 5 points using one command.
    3. Delete the grades of the 4th assignment.
    4. Calculate everyone's average grade using one command. Hint: Google is your friend.

  • For the second problem, create your own system of equations. Document what your system of unknowns represent and what your solution will represent. Help?

  • For the third problem, create your own plots. Be sure to use at least one exponential, trigonometric, or logarithmic function as part of your plots. Have FUN!
    1. Create the x-values and describe what they represent.
    2. Create the y-values and describe what they represent.
    3. Plot the x-values verses the y-values.
    4. Type hold on and plot another graph
    5. Label the x-axis, y-axis, and title. Also add a legend.
    Feel free to continue adding plots if you like, but be sure to update the legend.

  • For the fourth problem, create your own table and have it displayed in the Command Window.

  • Post your m-file hw1Last.m to Dr. Shah's Dropbox account. In order to get full credit, your directories and files must be named correctly and you must have links to your function file and the m-file (script file) that created the webpage, along with the appropriate text, plots, and such to answer the problems.