Exercises

Use Matlab to answer each question.

  1. Create a file named M-File_notes.m, enter some notes to yourself about m-files, and then save and close the file.

    To name a file, you must save the file. Be sure to choose a valid name.

    Create New File Editor window comments

  2. Create another m-file that contains the following text:

            function sa = surfaceArea( sideLength )
            % Returns the surface area of a cube with sides that are "sideLength" long.
            sa = 6 * sideLength.^2 ;
            

    Open file with text above

  3. Save the m-file that you created in the previous exercise with the name surfaceArea.m.

    Save As dialog box

    Saved surfaceArea.m