help needed workdue tomorrow

3 Ansichten (letzte 30 Tage)
Yusuf Muhammad Khan
Yusuf Muhammad Khan am 6 Nov. 2019
Kommentiert: John D'Errico am 6 Nov. 2019
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 Kommentar
John D'Errico
John D'Errico am 6 Nov. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by