Hello, how would I type this up in MATLAB. Also, can you screenshot how it looks
ID: 3840626 • Letter: H
Question
Hello, how would I type this up in MATLAB. Also, can you screenshot how it looks in Matlab with the answer if possible to make things easier. Thank you.
Problem 3) A fenced enclosure consists of a rectangle of length Land width 2R, and a semicircle of radius R, as shown below. The enclosure is to be built to have an area of 1600 fte. The cost of the fence is $40/ft for the curved portion and $30/ftfor the straight sides. Use the min function to determine with the resolution of 0.01 ft the value of Rand L required to minimize the total cost of the fence. Also compute the minimum cost. 2R L55-3Explanation / Answer
Matlab code for the Problem
% First creat a vector of possible value of R with a resolution 0.01
Resolution = 0.01;
R = 1:Resolution:50;
% Now Compute the corresponfing value of L using the relation of area
% 2*R*L+(pi*R^2)/2 = 1600
L = (1600-(pi*R.^2)./2)./(2*R);
% It is also possible to get the vector of L first but computation of L
% will be deficult
% Now compute the cost for the construction
Cost = 2*(R+L)*30+pi*R*40;
% Find the minum cost and its index
[MinCost,Index] = min(Cost);
% Find the minium L and R using the index
MinL = L(Index);
MinR = R(Index);
% Print the relavent informations
fprintf('Minimum cost = %f obtained for L = %f and R = %f ',MinCost,MinL,MinR);
OUTPUT
Minimum cost = 5157.484445 obtained for L = 28.371381 and R = 18.610000
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.