Difference between revisions of "EGR 103/Fall 2017/Minilab 7"

From PrattWiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Clarifications ==
 
== Clarifications ==
 
To mount your CIFS drive on a PC, use the instructions at: [[User:DukeEgr93/WindowsPermission#Mount_your_drive_via_windows|Mount your drive via windows.]]
 
To mount your CIFS drive on a PC, use the instructions at: [[User:DukeEgr93/WindowsPermission#Mount_your_drive_via_windows|Mount your drive via windows.]]
 +
 +
== Troubleshooting ==
 +
* If you get a broadcast error, it will generally tell you the number of elements in two variables that are different -- look in the variable explorer to figure out what sizes things are (and what they should be)and fix your code.  This has most often happened when someone uses the model values to create estimates or vice versa.
 +
 
== Typos ==
 
== Typos ==
Prior to 6:45am on 12/5/2017, these problems used numbers from a previous edition of the book.  This particularly changed the answers to 7.8.3 and 7.8.4.  Those have been updated.
+
*Prior to 6:45am on 12/5/2017, these problems used numbers from a previous edition of the book.  This particularly changed the answers to 7.8.3 and 7.8.4.  Those have been updated.
 +
* Problem 8.1 in the lab is really 8.2 in the book
  
 
== 7.8.1 ==
 
== 7.8.1 ==

Revision as of 17:57, 5 December 2017

Clarifications

To mount your CIFS drive on a PC, use the instructions at: Mount your drive via windows.

Troubleshooting

  • If you get a broadcast error, it will generally tell you the number of elements in two variables that are different -- look in the variable explorer to figure out what sizes things are (and what they should be)and fix your code. This has most often happened when someone uses the model values to create estimates or vice versa.

Typos

  • Prior to 6:45am on 12/5/2017, these problems used numbers from a previous edition of the book. This particularly changed the answers to 7.8.3 and 7.8.4. Those have been updated.
  • Problem 8.1 in the lab is really 8.2 in the book

7.8.1

Be sure to store your data using code similar to a = np.array([1, 2, 3, 4]) and not just a = [1, 2, 3, 4].

Also, to return the result of a long formula, be sure to put the whole thing in parentheses to break it across lines; for instance:

return (1 + 2 + 3 + 
     4 + 5 + 6 + 7)

For the legend, add labels to each plot command and then call the legend command; for example:

plt.plot(t, x, 'k-', label='position')
plt.plot(t, v, 'r--', label='velocity')
plt.legend()
St: 5.793e+00
Sr: 7.850e-02
r2: 9.864e-01

The model should be a green dashed line going through the data points.

7.8.2

Root 1: 2.338e+00
Root 2: 7.762e+00
Min of y=-2.086e+01 at x=+1.279e+00
Min of y=-3.274e+01 at x=+8.708e+00
Min of y=-2.086e+01 at x=+1.279e+00
Max of y=+1.953e+02 at x=+5.702e+00

The graph should be like your graph for Lab 5

7.8.3

(1)
[[ 5  8 15]
 [ 8  4 10]
 [ 6  0 10]]
(3)
[[ 3 -2 -1]
 [-6  0  4]
 [-2  0 -2]]
(4)
[[28 21 49]
 [ 7 14 49]
 [14  0 28]]
(5)
[[3 6 1]]
(6)
[[25 13 74]
 [36 25 75]
 [28 12 52]]
(7)
[[54 76]
 [41 53]
 [28 38]]
(8)
[[ 9  2]
 [ 4 -1]
 [ 3  7]
 [-6  5]]
(11)
[[ 66  19  53]
 [ 19  29  46]
 [ 53  46 109]]
(12)
[[46]]

7.8.4

8.3:
[[-15.18115942]
 [ -7.24637681]
 [ -0.14492754]]
8.5:
[[-0.53333333+1.4j       ]
 [ 1.60000000-0.53333333j]]

7.8.5

Note: when you define your function for curve fitting, the independent variable needs to be the first argument, followed by any constants you are trying to find. Your definition line will likely be something like:

def func(i, p_max, i_sat):
St: 2.327e+04
Sr: 1.116e+03
r2: 9.520e-01

Coefficients and graph should match your for this lab. Be sure you are using good initial guesses - bad initial guesses will result in a flat red line!