1 / 6100%
ENGR 133, Lab-03
Authored by: Jim Long
Created on: 6/22/2021
Exercise #1 ... Problem 5.1
Problem presentation
We are asked to construct a breakeven plot for producing and selling a chemical product. We are given values
for fixed cost (FC), variable cost (VC), quantity (Q), and unit selling price (P). We want to know the breakeven
point, the range of profitable production, and the quantity of product that produces maximum profit.
Initialize variables
Perform calculations
Evaluate results
Display results
title('Product Economic Model')
xlabel('Quantity Produced/Sold, millions of gallons')
ylabel('Total Revenue/Cost, $M')
legend('Total Cost','Total Revenue','location','northwest')
grid on
TC = FC + Q*VC; % returns Total Cost (TC) per year in $M
TR = Q*P; % returns Total Revenue (TR) per year in $M
TP = TR - TC; % returns Profit per year in $M
clc,clear,close all
FC = 3e6; % Fixed Cost in dollars per year
VC = 0.025; % Variable Cost in dollars per gallon produced
P = 0.055; % Selling Price in cents per gallon sold
Q = [0:200]*1e+6; % Quantity produced/sold in millions of gallons per year
idx=find(TP>0); % finding all possible indexes where TP is positive
minQ_idx=min(idx); % finding first index where TP is positive
BEP = Q(minQ_idx); % return Breakeven Point in millions of gallons per year
The breakeven point occurs at 101 million gallons.
Operations are profitable above this point.
There is no upper limit on profitability.
Exercise #2 ... Subplots
Problem presentation
We are asked to construct a 2 by 2 grid of plots showing sin(x), cos(x), e^x, and both sin(x) and cos(x) on one
subplot. We must include elements to create proper plots.
Initialize variables
Display results
fprintf('Operations are profitable above this point.\n\n')
clc,clear,close all
x = linspace(0,2*pi,1000); % Creating an array of 1000 equally spaced points from zero to
sin_x = sin(x); % Creating an array of sine values
cos_x = cos(x); % Creating an array of cosine values
exp_x = exp(x); % Creating an array of exponential values
fprintf('The breakeven point occurs at %3.0f million gallons.\n\n', BEP*1e-6)
fprintf('There is no upper limit on profitability.\n\n')
Exercise #3 ... 3-D Plots
Problem presentation
Create a plot of the function: z = (x-2)^2 + 2xy +y^2 that shows a mesh plot on top, followed by a contour plot
and a mesh plot with a contour plot on the bottom.
Initialize variables
Display results
plot(x,sin_x),title('f(x) = sin(x)'),grid on
xlabel('Angle in radians'),ylabel('sin(x)')
plot(x,cos_x),title('f(x) = cos(x)'),grid on
xlabel('Angle in radians'),ylabel('cos(x)')
plot(x,exp_x),title('f(x) = e^x'),grid on
plot(x,sin_x,x,cos_x,'--'),title('f(x) = sin(x),cos(x)'),grid on
clc,clear,close all
[X,Y] = meshgrid(-5:0.5:5); % Defining the xy grid of interest
Z = (X-2).^2 + 2*X.*Y + Y.^2;; % Defining the Z = f(X,Y) array