MatLab Exam 1 Problem Portion Feb 29 2024-1
MatLab Exam 1 Problem Portion Feb 29 2024-1
MatLab Exam #1
February 29, 2024
ENGR 2304-18842
6:00 – 7:50 pm
For this part of the exam, you need to solve the problems USING MATLAB [not your
eyeballs, not your calculator]. No references except what is in CANVAS that DOES
NOT OPEN IN A BROWSER WINDOW and what is in the MatLab help file. Calculator
allowed. You may write on this paper. You must use the classroom computers.
Your name and W# above indicate that the work here is entirely your own, that you
neither gave nor received help, and that you abided fully with the HCC Code of
Conduct.
Before the time expires on the exam at 7:55 pm, you need to turn in the script files
you created to the Module called MatLab Exam 1 – Modules 1, 2, 3 – Feb 20. There
is an assignment called MatLab Exam #1 – submit files HERE. The exam ends at
7:55 pm. Once the clock says 7:55 pm, you will not be able to submit.
All script files must follow the accepted format used in class with proper
commenting, the results copied/pasted into the script file, NO Semicolon that
suppresses the output in the command window, all variables are named [no use of
the default variable ans allowed], output identified using either DISP or FPRINTF,
graphs labelled with title and axes, etc.
1
%INFORMATION.
%VARIABLES.
%INPUT.
%PROCESS/ALGORITHM/CALCULATIONS.
%OUTPUT.
%RESULTS. Copy/paste results.
If these instructions are not followed, then half of the points of that problem will be
deducted.
Scoring:
2
P1. 20 points. Create a script file to solve the following problem. Solve the
following system of linear equations. You must use the method of multiplying by
the inverse and the method of left division. You must check your work.
Save as LastName_FirstName_MExam1_P1.
P2. 25 points. Create a script file to solve the following problem. A chemical
plant releases an amount A of a pollutant into a stream. The maximum
concentration C of the pollutant at a point which is a distance x from the plant is:
𝐴𝐴 2
𝐶𝐶 = �
𝑥𝑥 𝜋𝜋 ⋅ 𝑒𝑒
x = [0.5, 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 500, 1000, 5000, 10000,
50000, 100000]
Then plot C as a function of x. Put a title on the graph. Label the axes. Put a grid
on the graph. Make a decision as to whether to use a rectilinear graph of some sort
or a logarithmic graph – your choice. In the %RESULTS section describe what
happens to A as x increases and why you chose the type of graph you did.
Save as LastName_FirstName_MExam1_P2.
3
P3. 15 points.
Create a script file to solve the following problem. Implement the Law of Cosines.
Inputs are side lengths a, b, and c. Outputs are the measures of angles A, B and C
in degrees. Round to the nearest tenth [1 decimal place]. Check each solution – the
sum of the angles in a triangle should sum to 180 degrees.
Note that in the last equation cos(c) should be cos(C) – cos ( capital C ).
Save as LastName_FirstName_MExam1_P3
Create a script file to solve the following problem. Plot f(x)=sin(x) and g(x)=cos(x) and
h(x)=tan(x) on the same graph. Label the x-axis as Angle in Degrees and choose an
appropriate label for the y-axis. Put a title on your graph. Use a grid. Plot from 0 to 720
degrees using a fine enough increment to have a smooth curve.
Save as LastName_FirstName_MExam1_P4