ENGR 25 Prob 2.20 Round-End Fenced Enclosure 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 Given Fenced Enclosure Given Parameters • Total Enclosed Area = 1600 Square Feet (1600 ft2) • Fence Costs in $/Lineal-Ft – Straight = 30 – Curved = 40 Determine Lo-Cost R & L Engineering/Math/Physics 25: Computational Methods 2 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Given Fenced Enclosure Game Plan • Solve for COST FUNCTION f(R) • Solve by BOTH of – Hand Calculus Develop Cost Function – Use min command on Cost Vector Will hunt-down LoCost & Address Engineering/Math/Physics 25: Computational Methods 3 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Check Extremes Engineering/Math/Physics 25: Computational Methods 4 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Check Extremes The Cost at Maximum R Use the Extremes to Set the Plotting Range Engineering/Math/Physics 25: Computational Methods 5 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 6 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 7 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 8 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 9 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt .m File Script % Bruce Mayer, PE % ENGR25 * 29Jan11 % P1.20: Rounded-End Fenced Enclosure % file = P2_20_RoundEnd_FencedEnclosure_1201.m % % Guess that Rmin is between 5-30 feet. %* make ve R-vector with 0.01 ft resolution R = [5:0.01:30]; % % Calculate the "Vectorized" Cost using this R-Vector %* need the DOT on the divide to indicate element-by-element division C = (25*pi+60)*R + 48000./R; % % Make a plot to "EyeBall" Solution %* convert cost $k for easier interpretation plot(R,C/1000, 'LineWidth', 2),xlabel('R (ft)'),ylabel('Total Cost (k$)'), grid % disp('showing Cost Plot; hit ANY KEY to Continue') pause % % now use min command to hunt down exactly the minimum within Cost Vector,C [Cmin, Kmin] = min(C); % [Value, Address] % % Now that we the location of Cmin, We can find Rmin and Lmin at the SAME % Location Rmin = R(Kmin); % % Recall from Hand Work => Make an L-Vector % *Don't forget the DOT on SQUARE or DIVIDE operators L = (1600 - pi*R.^2/2)./(2*R); Lmin = L(Kmin); % % Now Summarize disp('---------Answer Below-----------') disp('Rmin, Lmin in FEET; Cmink in $k') Rmin Lmin Cmink = Cmin/1000 % % Summarizing Plot plot(R,C/1000, Rmin, Cmin/1000, 'p', 'LineWidth', 2),xlabel('R (ft)'),ylabel('Total Cost (k$)'), grid Engineering/Math/Physics 25: Computational Methods 10 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Answer Graphically 11 10 Total Cost (k$) 9 8 7 6 5 5 10 15 20 25 R (ft) Engineering/Math/Physics 25: Computational Methods 11 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt 30 L vs R Plot (for Fun) 160 140 120 L (ft) 100 80 60 40 20 0 5 10 15 20 25 R (ft) Engineering/Math/Physics 25: Computational Methods 12 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt 30 Engineering/Math/Physics 25: Computational Methods 13 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 14 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 15 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt 2-20 Engineering/Math/Physics 25: Computational Methods 16 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 17 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt Engineering/Math/Physics 25: Computational Methods 18 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_HW-01_Solution.ppt