1
ENGR 133, Lab-07
Authored by: Jim Long
Created on: 7/27/2020
Exercise #1 ... T11.2-2
Problem Presentation
Given two equations with three unknowns and are asked to solve for "x" and "y" in terms of "a".
Solution
Initialize variables
Perform Calculations & Display Results
X =
Y =
Exercise #2 ... Problem 11.12
Problem Presentation
Determine all the local minima and local maxima and all the inflection points where dy/dx=0 of the following
function:
Solution
Initialize variables
Perform calculations
[X, Y] = solve(eqn1,eqn2,{x y})
clear,clc,close all
syms a x y
eqn1 = x + 6*y == a;
eqn2 = 2*x - 3*y == 9;
clear,clc,close all
syms x
y = x^4-(16/3)*x^3+8*x^2-4; % initialize function
dydx = diff(y); % find derivative
d2ydx2 = diff(dydx); % find second derivative
2
Find x and y values of interest
Loop to evaluate nature of zero points
Display results
A local minima exists at x = 0.00, y = -4.00.
A inflection point exists at x = 2.00, y = 1.33.
A inflection point exists at x = 2.00, y = 1.33.
for k = 1:length(x_points)
eval(k) = subs(d2ydx2,x,x_points(k)); % solving 2nd derivative for x value
if double(eval(k)) > 0 % checking to see if local minima
outcomes(k) = "local minima";
elseif double(eval(k)) == 0 % checking to see if inflection point
outcomes(k) = "inflection point";
else
outcomes(k) = "local maxima"; % otherwise, point is local maxima
end
end
x_points = solve(dydx); % find roots of derivative dy/dx = 0
y_points = subs(y,x,x_points);
for k = 1:length(x_points)
fprintf('\nA %s exists at x = %4.2f, y = %4.2f.\n\n',outcomes{1,k},...
double(x_points(k)),double(y_points(k)))
end
fplot(y,[double(x_points(1))-1 double(x_points(length(x_points)))+1])
grid minor
3
Exercise #3 ... Problem 11.20
Problem Presentation
Here we have the case of a rocket launch where the fuel burns for a specified length of time and we are
interested in knowing the velocity at the end of the fuel burn. We are given the functions that describes the
acceleration (dv/dt) and mass as a function of time as fuel burns.
Solution
Initialize variables
Perform calculations
Display results
The rocket velocity at fuel burnout is v = 1363.35 m/s.
v_t = int((T/(mo*(1-r*t/b)))-g,to,tf);
v_b = double(subs(v_t,{T mo r b g to tf},{48000 2200 0.8 40 9.81 0 40}));
clear,clc,close all
syms t T mo r b g to tf
fprintf('\nThe rocket velocity at fuel burnout is v = %6.2f m/s.\n\n',v_b)