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.
help needed workdue tomorrow
2 次查看(过去 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)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!