



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ME2016, Fall 2008, Dr. Ferri Homework Assignment 9 October 29, 2008
Problem 1. (2 points)
Consider the linear-programming problem: Maximize (^) 1 2 3
z = x + x , subject to:
x 1 (^) + 2. 5 x 2 ≤ 15 , x 1 (^) + x 2 ≤ 7 , x 1 (^) ≤ 3
x 1 ≥ 0 , x 2 ≥ 0
(a) Obtain the solution graphically. Use Matlab to plot the feasible region and some contour lines for z. (b) Check your answer using the Matlab program linprog.
Solution
2
4
6 8
2
6
4
z=5 z=
x (^1)
(3, 4), z = 9
(b) Matlab
f=[5/3 1]'
f =
A = [1 2.5; 1 1]; b = [15 ; 7]; LB = [0; 0]; UB = [3; inf]; x = linprog(-f,A,b,[],[],LB,UB)
Optimization terminated.
x =
z=f'*x
z =
Problem 2. (3 points) Consider the linear-programming problem: Maximize z = x 1 + x 2 , subject to:
x 1 (^) + 2 x 2 ≤ 8 (2.1) 2 x 1 (^) + x 2 ≤ 9 (2.2) x 1 (^) + x 2 ≤ 7 (2.3)
x 1 ≥ 0 , x 2 ≥ 0
(a) Use the graphical procedure to find the maximum value of z and the (x 1 , x 2 ) combination at which this maximum occurs. You can plot the feasible region by hand, or use Matlab to help you. (b) How does your solution change if constraint (2.3) is removed?
Solution Turning (2.1)-(2.3) into equalities , we can plot the boundaries of the feasible region. As seen below, the maximum value of z is governed by the intersection of the bounds of (2.1) and (2.2):
1 2 2
x x x
x
Thus, the maximum value of z is (10/3) + (7/3) = 17/3 = 5.6667 We see that constraint 2.3 has no effect on the maximizing solution.
x = x 0 (^) − ∂( f / ∂ x h ) = 1 + 2 h ,
y = y 0 (^) − ∂( f / ∂ y h ) = 1 + 8 h.
Substitute into f(x,y) :
f ( , x y ) = (1 + 2 h − 2)^2 + 2(1 + 8 h − 3) 2 = g h ( ),
g h ( ) = 264 h^2 − 68 h + 9.
Minimum occurs where 17 0 264 68 0 0. 66
dg h h dh
Thus, (^1)
x = + = = , (^1)
y = + = =
Gradient at (x 1 , y 1 ) =
f i j
. Move in negative gradient direction:
1
h x x h
h y y h
= − =. Substitute into f(x,y) , get
2 2
h h g h
=. Minimum occurs
where 17 0 2304 1088 0 0. 36
dg h h dh
So,
2 1
x = x + h = = ,
2 1
y = y − h = =
So, x 2 (^) = 1.9731, with 1.34% relative error
and y 2 (^) = 2.9461, with 1.79% relative error
0 1 2
3 4
5
0
2
4
60
5
10
15
20
25
30
x
y
(^00 1 2 3 4 )
1
2
3
4
5
Problem 4. (2 points) The following data (next page) was taken by a student in ME4053 to measure the speed of sound. The first column gives the distance between the speaker and the microphone (in meters) and the second column gives the measured time-delay between when a signal is sent to the speaker and when the signal reaches the microphone (in milliseconds). (a) Plot the data with the range on the x-axis and the time delay on the y-axis. (b) Perform a linear regression on the data. Plot the straight line on the same plot as part (a). (c) Calculate the speed of sound by taking the inverse of the slope of your linear regression line. Express your answer in meters per second.
Range (m) Time (ms) 0.02 0. 0.04 0. 0.06 0. 0.08 0. 0.10 0. 0.12 0. 0.14 0. 0.16 0. 0.18 0. 0.20 0. Solution
0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.
2
3
4
5
6
7
8
x 10
x
Delta t
Data Curve Fit