Chp3 Tutorial: Prob 3.15 Solution

advertisement
Engineering 25
Chp3
Tutorial:
Prob 3.15
Solution
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
BMayer@ChabotCollege.edu
Engineering/Math/Physics 25: Computational Methods
1
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Engineering/Math/Physics 25: Computational Methods
2
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Engineering/Math/Physics 25: Computational Methods
3
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
4
Engineering/Math/Physics 25: Computational Methods
4
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Quick Solve by Anon
 Use Anonymous Function to
very Quickly Solve for rmin
% Bruce Mayer, PE * 10Oct16
% ENGR25 * Problem 3-15
% file = P3_15_ConeArea_1010
%
% use Anonymous-Fcn in fminbnd
V = 10; % set volume here
Acone = @(r)sqrt(pi^2*r.^4 + 9*V^2./r.^2);
fplot(Acone, [1 3]), xlabel('Cone Radius, r (inches)'),...
ylabel('Surface Area, A (Sq-in)'), grid
disp('Showing FullScale Plot; Now ZoomIn and Use DataCursor
- Hit any Key')
pause
fplot(Acone, [1.8 2]), xlabel('Cone Radius, r
(inches)'),...
ylabel('Surface Area, A (Sq-in)'), grid
% determine solution using fminbnd
rmin = fminbnd(Acone,1,4)
Amin = Acone(rmin)
Engineering/Math/Physics 25: Computational Methods
5
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
fminbnd Command
 fminbnd finds the minimum
of a function of one variable
within a fixed interval.
 Syntax for this case
• [x,fval] = fminbnd(fcn,x1,x2)
– [x, fval] = fminbnd(fcn,x1,x2)
returns a value x that is a local
minimizer; i.e., xmin. of the
function that is described in fcn
over the interval x1 < x< x2.
 fval is the minimum value of the
function for the corresponding
minimizing x; that is fval = fcn(xmin).
Engineering/Math/Physics 25: Computational Methods
6
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Function File
 area3_15.m
function A = area3_15(r);
% Bruce Mayer, PE * 12Feb06
% ENGR25 * Tutorial on Functions & Globals
%
%This function calcs the area of a
%concical paper cup given the cup-Volume
%
%Declare Volume-V as global so it does NOT
%need to appear in the Function CALL
global V
%
% calc Section
% NOTE: Use ARRAY operator as r could be an array
% NOTE also that the Constraint, V, is NOT an array
A = sqrt(pi^2*r.^4 + 9*V^2./r.^2);
Engineering/Math/Physics 25: Computational Methods
7
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Command Session
>> global V
>> V = 10; % cu-inches
>> r = [0.5:0.01:5]; % inches
>> plot(r,area3_15(r))
>> [rmin, Amin] =
fminbnd('area3_15',1,3)
rmin =
1.8901
Amin =
19.4393
>> hmin = 3*V/(pi*rmin^2)
hmin =
2.6730
Engineering/Math/Physics 25: Computational Methods
8
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
The Sensitivity Plot
80
70
60
50
40
30
~21.37
20
~1.49
10
0.5
1
~2.35
1.5
2
2.5
3
3.5
4
 +10% on Amin
• Amax = 1.1* 19.73 = 21.37 in2
 r →  1.49 – 2.35 in
Engineering/Math/Physics 25: Computational Methods
9
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
4.5
5
Comments
 The 10% increase in Amin
Results in These Changes
for rmin
• -23% for rlo
• +24% for rhi
 Thus The change in Area is
less than half the change in r.
• A is NOT very Sensitive
About the
Minimum Point
Engineering/Math/Physics 25: Computational Methods
10
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt
Download