How do I find the minimum Surface area of a cylindrical shape and its corresponding minimum radius and height which have a range of values

5 vues (au cours des 30 derniers jours)
How do I find the minimum Surface area of a cylindrical shape and its corresponding radius and height which have a range of values.
I tries using [SA,index]=min(SA)
but it only gives me the corresponding index for the radius value
  1 commentaire
Torsten
Torsten le 5 Nov 2022
but it only gives me the corresponding index for the radius value
No, SA in the list of outputs is the minimum Surface area.

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 5 Nov 2022
Modifié(e) : John D'Errico le 5 Nov 2022
You did write JUST enough MATLAB that I cannot in good faith close this as a homework assignment with no effort made. So I'll answer it in a way that will force you to read what I wrote, and think about the solution enough to to do your homework assignment, as simply copying what I wrote would obviously be plagiarism.
Do you know the formula for the area of a cylinder? If not, then why not? Spend the time and effort to derive it (easy, basic algebra) or look it up online. It is there to be found.
Anyway, the minimum surface area of a cylinder is zero. So a cylinder of radius and height zero.
So my guess is, your homework assignment is to do that, for perhaps a given fixed volume of the cylinder. Now you COULD in theory, find a minimum. You could do that analytically, using the symbolic toolbox. You could formulate the problem using Lagrange multipliers. Lots of things you could do. Of course, if I answered your question, using Lagrange multipliers you still could not use it for your homework solution, as your teacher would still give you zero credit for plagiarism.
So what is the volume of a cylinder with radius r, and height h?
syms r h V
% The volume is simple, as the height times the area of a simple circular
% base. I'll assume the volume is known.
Volume = V == pi*r^2*h
Volume = 
% The area is also as simple. Two circular bases, plus the area of the
% cylindrical side, as the height, times the perimeter of the circle.
Area = 2*pi*r^2 + 2*pi*r*h
Area = 
Now how can we minimize the area, subject to a fixed volume V? One simple way to do that is to solve for say h, in terms of V and r. Substitute into the area relation, leaving only r as the unknown. This will also have V as a variable in it.
Area = subs(Area,h,solve(Volume,h))
Area = 
Now, suppose we have a fixed volume? What does this relationship look like? We can arbitrarily choose V = 1, to see the basic shape.
fplot(subs(Area,V,1),[0,3])
xlabel Radius
ylabel Area
title 'Fixed volume, V=1'
grid on
And there we see the area does indeed have a minimum value for a fixed volume. It looks to lie roughly around r=0.5. Differentiating and then solving, we find three solutions, but two will be complex. So only one real solution.
rsol = solve(diff(subs(Area,V,1))==0)
rsol = 
vpa(rsol(1))
ans = 
0.54192607013928900874456136482964
Could we have solved this using Lagrange multiplers? Yes, surely so.
syms r h V lambda
Area = 2*pi*r^2 + 2*pi*r*h;
Volume = pi*r^2*h;
Next, formulate an objective as:
obj = Area + lambda*(V - Volume);
gradient(obj,[r,h,lambda])
ans = 
sol = solve(gradient(obj,[r,h,lambda]) == 0,[r,h,lambda])
sol = struct with fields:
r: [3×1 sym] h: [3×1 sym] lambda: [3×1 sym]
sol.r
ans = 
sol.h
ans = 
Again, we want only the first solution, since that is the only real one.
simplify(sol.r(1))
ans = 
simplify(sol.h(1))
ans = 
If V is set to 1, indeed that is the same solution as we saw before. We could probably have used fsolve to find that same solution. Or fmincon. In either case of course, we would need to fix V at some fixed value.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by