05-21.txt
来自「MATLABR2007教程以及i习题和答案」· 文本 代码 · 共 14 行
TXT
14 行
% find the minimum of the function f(x)=x^3+a*x^2+b*x+c
function [x0,y] = funmin(a,b,c,x1,x2)
options = optimset('Display','off');
[x0,y] = fminbnd(@poly3,x1,x2,options);
function y=poly3(x) %the nested function
y=x^3+a*x^2+b*x+c;
end
% plot the function
fplot(@poly3,[x1,x2]);
hold on;
plot(x0,y,'.');
end
>> [x,y]=funmin(-1000,10,0,600,800)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?