Part 1: Programming The Find - H Function: Lab Activity 4 - Answers
Part 1: Programming The Find - H Function: Lab Activity 4 - Answers
Remember: h0 is given as HL, while h6 is HR for this case. They are given
constants and NOT part of the final h that we're trying to solve.
______ K3(h2-h3) + K2(h2-H1) =B2_____________________
K4(h3-h4) + K3(h3-H2) =B3_______________________________
2. Rewrite the five equations in question 1 such that the coefficients for each
unknown are grouped properly and all the constants are moved to the right
hand side. The first equation has been done for you:
_______________(K1+K2)h1 + (-K2)h2 = B1 + K1HL________________
Make sure HL and HR are moved to the right hand side since they are part of
the constant terms.
Write down the equation that you are going to solve, in the matrix
form [matrix]*[column vector] = [column vector]. (Hint: see the matrix
equation in the MP 1 write-up above equation_4 in the 3. Math section.)
*
rhs(N) = ____________________________________ ;
10. Fill in the blank to solve the system of equations using the backslash (\)
operator, and store the result in a vector h:
h = __________________________________ ;
11. Fill in the blank to transpose the column vector h into a row vector.
12.
13. Write the value that Matlab returns when you type the following at the
command prompt:
>> x
x=
_____________________________
>> y
y=
_____________________________
>> result
result =
___________________________
14. Write the value that Matlab returns when you type the following at the
command prompt:
>> result = dummy(-4)
result =
_____________________________
>> y = dummy(0)
y=
_____________________________
>> result
result =
___________________________
15. In the editor modify the code for the dummy function by adding
the global command as shown below,
function result = dummy(parameter)
global x
x = 4;
result = x + parameter;
Write the value that Matlab returns when you type the following at the
command prompt:
>> global x
>> x
x=
_____________________________
>> y = dummy(-4)
y=
_____________________________
>> x
x=
___________________________
16. In the editor modify the code for the dummy function by removing the
statement x =4; so that your function should now look like the following:
function result = dummy(parameter)
global x
result = x + parameter;
Write the value that Matlab returns when you type the following at the
command prompt:
>> x = 10;
>> y = dummy(-4)
y=
_____________________________
Part 3: Dynamics
17. Fill in the blank to complete the code for the function
named Derivatives_resistance .
dydv = _________________________________________________________
18. What is the time (in seconds approximately) when the object hits the ground (y
= 0) ? Hint: plot t versus y. Use grid on command too.
t = _________________________________________________ (approx.)
19. What is the velocity ( meters/second approximately) when the object hits the
ground (y = 0)?
v = _________________________________________________(approx.)
(Of course this is the same answer as in prelab 5 question 6b)
20. Increase A (area) in the function named Derivatives_resistance so that the
terminal velocity is about -10 meters/second. Round answer to nearest integer
value.
A = ______________________________________________________
21. Complete the function named xyzprime that will compute the derivatives of the
three dependent variables x, y and z , by filling in the blanks.
function dxdydz = Derivatives_xyz(t , xyz)
x = xyz(1);
y = xyz(2);
z = xyz(3);
dxdydz = [ ______________________________;
_________________________________ ;
___________________________________];