用matlab 求下列函数极值,y=exp(x)-x^5,初始点为x=8.万分感激.
问题描述:
用matlab 求下列函数极值,y=exp(x)-x^5,初始点为x=8.万分感激.
答
clear;clc
x0=8;
eq=@(x)exp(x)-x^5;
[xmin fval]=fminsearch(eq,x0)
ezplot(eq,[7 14])
hold on
plot(xmin,fval,'*r')
%%%%%%%%%%%%%%
运行结果:
xmin =
11.3134
fval =
-1.0343e+005