Docsity

Enclosure - Computational Methods - Lecture Slides, Slides of Computational Methods

Partial preview of the text

Download Enclosure - Computational Methods - Lecture Slides and more Slides Computational Methods in PDF only on Docsity!

Prob 2.

Round-End

Fenced

Enclosure

Given Fenced Enclosure

  • Given Parameters
    • Total Enclosed Area = 1600

Square Feet (1600 ft

  • Fence Costs in $/Lineal-Ft
    • Straight = 30
    • Curved = 40
  • Determine Lo-Cost R & L

% Bruce Mayer, PE % ENGR25 * 29Jan % 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 = (25pi+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 - piR.^2/2)./(2*R); Lmin = L(Kmin); % % Now Summarize disp('---------Answer Below-----------') disp('Rmin, Lmin in FEET; Cmink in $k') Rmin Lmin Cmink = Cmin/ % % Summarizing Plot plot(R,C/1000, Rmin, Cmin/1000, 'p', 'LineWidth', 2),xlabel('R (ft)'),ylabel('Total Cost (k$)'), grid

.m File Script

Answer Graphically

R (ft)
Total Cost (k$)