Wednesday, September 28, 2005

How to find minimum value of a function

y=0:.001:6;
f=(sqrt(25+(6-y).^2)/3)+(y/5);
plot(y,f);
min(f)
a=y(find(f==min(f))) %returns the optimum value of y
x=sqrt(25+(6-a)^2) %returns the optimum value of x
heading_angle=acos(5/x)*180/pi %returns the optimum value of headding angle


0 Comments:

Post a Comment

<< Home