Applications with MATLAB®
For exercise 1, please scan/take a picture of your hand calculations for solving the system of equations. All hand calculations should be done on engineering paper and set up in the problem solving format discussed at the beginning of the semester. Please copy Matlab® code used to generate your solutions and the solutions to your system of equations in a Word document for exercises 1 and 2.
For Exercises 3-6, please copy any figures into a Word document with the code you used to generate that figure. If you used scripts (m-files) to generate your figures, please turn those in instead of copying your code into a word document. If code used to generate your answers is not provided, no credit will be given.
** THIS ASSIGNMENT IS TO BE DONE ON AN INDIVIDUAL BASIS!**
Exercise 1 – Simultaneous Equations
A. Solve the following equations for x, y and z:
2𝑥 + 2𝑦 − 3𝑧 = 9 −3𝑥 + 4𝑦 + 𝑧 = −3 𝑥 − 3𝑦 + 2𝑧 = 0
Step 1: Write the A and B matrix
Step 2: Using MATLAB solve for unknowns
Step 3: Verify your answer by solving by hand (use substitution or elimination)
B. Solve the following equations for x, y and z:
3𝑥 − 𝑦 + 3𝑧 = 1 5𝑥 + 5𝑦 + 5𝑧 = 4 −2𝑥 + 9𝑦 − 2𝑧 = −3
Step 1: Write the A matrix and B matrix
Step 2: Using MATLAB solve for unknowns. (Make sure to note what is happening with this system of equations)
Exercise 2 – Spring Analysis
The position of three masses suspended vertically by a series of identical springs can be modeled by the following steady-state force balances:
0k(x x)mgkx 2111
0k(x3 x2)m2gk(x2 x1) 0m3gk(x3 x2)
If g = 9.81 m/s2, m1 = 4 kg, m2 = 2 kg, m3 = 2.5 kg and k = 8 N/m, find the displacements, x.
Step 1: Identify and Write the A and B matrix
Step 2: Using MATLAB solve for unknowns. What do each of these values represent?
Exercise 3 – Plotting with MATLAB Consider the following x and y data:
x: -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
y: -125, -64, -27, -8, -1, 0, 1, 8, 27, 64, 125
1. Type in >>help plot and summarize what you learn.
2. Plot the x, y data as green, square data points without connecting lines. 3. Add a chart title, x-axis title and y-axis title.
4. Plot the x, y data as yellow diamonds with yellow, solid connecting lines. 5. Plot the x, y data as cyan stars with dotted connecting lines.
Exercise 4 – Plotting with MATLAB Consider the following x and y data:
x: -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
y1: 25, 16, 9, 4, 1, 0, 1, 4, 9, 16, 25
y2: -125, -64, -27, -8, -1, 0, 1, 8, 27, 64, 125
1. Type in >>help plotyy and summarize what you learn.
2. Plot the x, y1 and y2 data on the same graph, with y1 and y2 on different y-axes. 3. Use the legend command to label each line.
Exercise 5 – Plotting with MATLAB
A certain scientist collected Force data at the following accelerations, a, for each mass shown, m.
a: 1, 5, 10, 15, 20, 25, 30, 35, 40, 45 m: 1, 5, 10, 15
The units of acceleration are (𝑚) , and those of mass are kg (the units of Force are N). 𝑠2
1. Knowing that F = ma, determine the Force vectors associated with each mass studied.
2. Plot Force versus acceleration for each mass studied. All plots must be on the same graph with the following appearance characteristics:
• One curve is blue with diamonds • One curve is green with squares • One curve is yellow with stars
• One curve is red with triangles
• A legend located in the upper left hand corner of the graph • Properly labeled axes with appropriate units
• A descriptive title
Exercise 6 – Regression Analysis
A certain nuclear physicist collected the following data from a particle accelerator experiment:
14 Energy (J) x 10
0.001 1.0
0.002 1.6
0.003 2.9
0.004 3.6
0.005 4.4
0.006 5.7
0.007 6.4
0.008 7.3
0.009 8.1
0.010 10
1. In MATLAB, type >>help polyfit and summarize what you learn. 2. Based upon the regression, determine the speed of light (m/s).
Make sure that the plots are well formatted and commented.
HINT: energy=mass×(speed of light)2 E mc2 Due Date: Wednesday October, 30th 10:00 p.M.
For exercise 1, please scan in your hand calculations for solving the system of equations. All hand calculations should be done on engineering paper and set up in the problem solving format discussed at the beginning of the semester. Please copy Matlab® code used to generate your solutions and the solutions to your system of equations in a Word document.
For Exercises 3-6, please copy any figures into a Word document with the code you used to generate that figure. If you used scripts (m-files) to generate your figures, please turn those in instead of copying your code into a word document. If code used to generate your answers is not provided, no credit will be given.
Mass (kg)