x=0:0.001:2; y=humps(x); plot(x,y); 如何求其最大值,需要matlab的程序?

来源:学生作业帮助网 编辑:作业帮 时间:2024/10/04 12:53:25
x=0:0.001:2; y=humps(x); plot(x,y); 如何求其最大值,需要matlab的程序?
xN@_eT,1FF0)JDP EBRj Cox-u7{wϙ F0}4} P&|u`SBl& 9 k5sl (oh:AΘح~6WVFd,y9',ES#邘!Pluz{"S㫏'uȫfo]b },0_. sX"MĒ yݬ Xc >dՕ;rhO T셲@{CcbXlW}UʗB#0rr PEtm 9j7!4jONw> *e@Ȇah]RDRK2g)6؟~

x=0:0.001:2; y=humps(x); plot(x,y); 如何求其最大值,需要matlab的程序?
x=0:0.001:2; y=humps(x); plot(x,y); 如何求其最大值,需要matlab的程序?

x=0:0.001:2; y=humps(x); plot(x,y); 如何求其最大值,需要matlab的程序?
x = fminbnd(@(x)-humps(x),0,2)
对的 需要matlab程序,上面的程序可以算出来你要的最大值
humps是matlab内置的演示函数也就是驼峰曲线函数
fminbnd 是matlab求区间函数最小值的函数,区间是【0,2】.这里我用来求-humps的最小值,也就得出来相应的humps的最大值(x取值多少时候 函数最大)
@(x)-humps(x) 是matlab匿名函数的一种形式 研究下 不难的