Math 171 - Alexiades
Lab 1
Basics of Matlab, submitting labs

( always read the entire Lab before you start working on it)

A. Submission of Assignments
  • All assignments will be posted in the ASSIGNMENTS page on the 171 course site ,   NOT on Canvas, but
  • Lab assignments are to be submitted, in a single PLAIN TEXT file, on Canvas   by clicking on Assignments.

    B. Explore Matlab
    0. Install Matlab on your computer(s). See CourseInfo page.
    1. Matlab IDE and GUI
      a. On your computer, find and click on MATLAB. Wait for it to start...
      b. Click on Help menu and select Examples, or at the prompt enter: demo matlab.
       Watch the first three videos at home...
    2. Tutorials galore
      a. The newer versions of Matlab include a Getting Started webified tutorial (not very good...).
        At the matlab prompt type: >> doc
        In right pane of the "Documentation" popup, click on MATLAB, then on Getting Started, then Language Fundamentals.
        Glance through Entering commands to get an idea.
        Learn MATLAB Basics at Mathworks site.   Also see: Getting started with Matlab
      b. Many other, better, tutorials are listed under On Maple and Matlab on the main course page .
        Explore some for those, bookmark any you like.
    3. Learn basics of Matlab
      by actually entering (several of) the examples into the Command Window, trying to understand what's happening and learn.
      a. In bkbn (bookboon) work through sections 2 and 3.
      b. In Downey, work through § 1.1−1.7

    C. Work to be turned in: (practicing how to submit Labs)
      Prepare a file   Lab1.txt   for submission, as follows:
      Matlab has a scripting function, called diary. Type: >> help diary to learn about it.
      Go to the Command Window of the Matlab GUI and start logging the session: >> diary Lab1.txt  
      Whatever appears on the Command Window will also be recorded in the file "Lab1.txt" .
      Use appropriate matlab operations for all the following.
      a. Every submission should contain identifiers for Lab#, Name, Date. Enter them, as comments:  
          >> % Name: YOUR NAME
          >> % Lab : Lab1
          >> % Date: today's DATE
      b. Set the values:   x = 4.e0   and   y = 30.e−1 . Then find:   z = x+y^2   and   w = (x+y)^2 .
      c. Enter:   pi2 = pi / 2 , and find   sin(pi2) .
          Then type:   format long ;   pi2   (notice the semicolon). To revert to short, enter:   format short
      Now close the diary:   >> diary off .

    Where did the file "Lab1.txt" go?   It's in the Matlab workspace (location differs by operating system),
    but it should show up in the left pane under "Current Folder". Double-clic on it to open it in the built-in Editor and you can edit it.
    It is a plain text (ascii) file, so it can be edited with any PLAIN TEXT editor (e.g. vim or gedit or 'notepad', do NOT use Word !!!).
    Learning to use such an editor is highly recommended.
    Using any such editor, edit the file  Lab1.txt to clean it up, leaving only the correct version of what's asked for in part C (commands, answers).
    Also remove some useless blank lines. Make sure you SAVE it after each modification. Save often!

    Copy the file to your desktop (out of Matlab). Then submit it on Canvas, as described in part A.

    Good housekeeping: On your computer create a folder "M171", and inside it a folder "Lab1". Move the file "Lab1.txt" into Lab1.
    You should do this for each lab.

      All done!