Sie sind auf Seite 1von 2

N

o
1

Answer
function cost=optim3(r)
% use r=fminbnd('optim3',0.01,1000)in command
windows
cost=40./r.*(2000(pi.*r.^2)./2)+80.*r+50*pi.*r
L=((2000-0.5*pi*r^2)/2*r)
In command windows answer
cost =
7.4672e+03

L =
1.3701e+04

r =

21.4270
function C=Conv1(F)
%Conv1 converts degrees F to degrees C
C=5*(F-32)./9;
a1=4.5; b1=2.25; T1=40; T2=92; alpha=23e-6;
deltaT= Conv1(T2)- Conv1(T1);
a2=a1+alpha*a1*deltaT;
b2=b1+alpha*b1*deltaT;
AreaChange=a2*b2-a1*b1;
fprintf('The change in the area is %6.5f
meters square.',AreaChange)

>> r=[2:0.1:10];
>> cost=600./r.*(500(2*pi.*r.^3)/3)+800*pi.*r.^2;
>>plot(r,cost),xlabel('radius'),ylabel('cost')

>> [cost,r]=ginput(1)
cost =
9.1371e+004
r =
4.9357

Das könnte Ihnen auch gefallen