help needed workdue tomorrow
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i need a numerical solution to the question below please, my code doesnt work:
question
The volume ? and paper surface area ? of a conical paper cup are given by ? = 1 3 ?? 2ℎ ? = ??√? 2 + ℎ 2 where ? is is the radius of the base of the cone and ℎ is the height of the cone. a. By eliminating ℎ, obtain the expression for ? as a function of ? and ?. [2 marks] b. Create a user-defined function that accepts ? as the only argument and computes ? for a given value of ?. Declare ? to be global within the function. [2 marks] c. For ? = 10 [??3 ], use the function with the fminbnd function to compute the value of ? that minimizes the area ?. What is the corresponding value of the height ℎ? Investigate the sensitivity of the solution by plotting ? versus ?. How much can ? vary about its optimal value before the area increases 10 percent above its minimum value? All plots must be formatted and labelled. The output shall be user-friendly.
my code:
%% Q11
clc;clear
global V
V = 10;
minr = fminbnd(@areaR,0,10),
minh = (3*V/(pi*minr^2)),
minA = areaR(minr),
r = 1:0.1:5;
A = areaR(r);
plot(r,A);
xlabel('r');
ylabel('Area');
Ua = minA+0.1*minA;
Lr = r(A < Ua & A >minA);
Range_r = max(Lr) - min(Lr)
1 comentario
John D'Errico
el 6 de Nov. de 2019
You need to start with writing a FUNCTION. This is a script. It does not take any argument at all. So start by learning how to write and use functions.
Respuestas (0)
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!