help needed workdue tomorrow
16 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
John D'Errico
2019 年 11 月 6 日
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.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!