5. Use MATLAB for the following question: The volume V and paper surface area A
ID: 3819028 • Letter: 5
Question
5. Use MATLAB for the following question:
The volume V and paper surface area A of a conical paper cup are given by,
V= 1/3hr^2, A=r r^2+h^2
where r is the radius of the base of the cone and h is the height of the cone.
i. By eliminating h, obtain the expression for A as a function of r and V.
ii. Create a user-defined function that accepts R as the only argument and computes A for a given value of V. Declare V to be global within the function.
iii. For V= 12 in^3, use the function with the fminbnd function to compute the value of r that minimizes the area A. What is the corresponding value of the height h? Investigate the sensitivity of the solution by plotting V versus r How much can R vary about its optimal value before the area increases 8 percent above its minimum value?
Explanation / Answer
Solution 1 and 2
function Area= Cone(R)
V=12;
syms r h v A % all Variables
eq1=v==1/3*pi*r^2*h; % equation 1
fprintf('h=');
h_value=solve(eq1,h); % new h value for equation
disp(h_value);
eq2=A==pi*r*sqrt(r^2+h_value^2); % equation 2 with new h value
fprintf('A=');
sol=solve(eq2,A); % solve equation 2 for A as a function of V and r
disp(sol);
solution=solve(eq2,v==V,r==R);
Area=double(solution.A);
end
Solution 3:
clc;
clear all;
v=12;
syms r h A % all Variables
eq1=v==1/3*pi*r^2*h; % equation 1
fprintf('h=');
h_value=solve(eq1,h); % new h value for equation
disp(h_value);
eq2=A==pi*r*sqrt(r^2+h_value^2); % equation 2 with new h value
fprintf('A=');
sol=solve(eq2,A); % solve equation 2 for A as a function of V and r
func=matlabFunction(sol);
disp(func);
x1 = 0;
x2 = 10000000000;
x = fminbnd(func,x1,x2);
h_sol=solve(eq1,r==x);
fprintf('Min value of r = %f, New h value: %f ',x,double(h_sol.h));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.