Prog 3

MET 16400 – HW week 3 programming
Due: January 30, online
Objective: To learn sequential Matlab programming commands with graphics
Requirements:
Create an m-file that creates the function “drawMonument()” that takes one optional
input argument and produces up to one optional output matrix. The function will draw a
wireframe figure of the Washington Monument (Washington, DC) using plot3()
commands. The optional input argument will specify the color of the line drawing which
defaults to green if nothing is specified. The output value will be a matrix of 3-D points
defining the 9 vertices of the monument.
The Washington Monument is 555 feet tall (169.3 m) with a square base that is 51 feet
(16.8 m) on a side. At a height of 500 feet (152.4 m), the square cross section is 10 meters
on a side. You must use plot3() commands to sequentially draw, one line at a time, the
sixteen lines that compose the wireframe model of the monument. The routine must be
coded as a function that can take a string argument to specify the drawing style that
plot3 uses to draw the lines. Use the “nargin” and “nargout” commands to
determine if an input argument or output variable appears. Use “if …, end” and “if
…, else …, end” statements as needed to process the inputs and outputs.
The output matrix, if needed, should be a 9 x 3 matrix of vertices. Do not output this
matrix if nargout is zero.
Include comments in your code that explains what you did with each step. Also include a
comment block at the top of the function that includes a description of what the file does.
This must include a description of all inputs and outputs. This information should be
displayed when you enter “help drawMonument” at the command line.
Include your name and ID as a comment in such as way that it does not appear in the
“help”. See “coding style” on the website.
Deliverables:
A copy of your code, a copy of the command window output with an output matrix, and a
copy of the figure (such that all 16 lines are visible). Also, include a screen capture of the
response to “help drawMonument”.