minval.m

来自「压缩包里包含了无约束优化问题常用的几种求解方法的源程序:变量轮换法(variab」· M 代码 · 共 19 行

M
19
字号
function min=minval(str,solvec)
%  File name:minval.m      
%  Author:Yan Anxin
%  ID number:081810
%  Date:finished on 2008.11.18
%  Description:  
%       Here defines a function,to get the value of the given function and the given point    
%       In the syntax min=minval(str,solvec),
%       str----input,means the expression of given function
%       solvec----input,means the given point
%       min=minval(str,solvec) returns min, i.e. the the value of the given function and the given point       

f=str;
n=length(solvec);            %gets the number of variables
for p=1:n
    s=sym(['x' num2str(p)]);
    f=subs(f,s,solvec(p));
    min=f;
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?