⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seminf.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [x,options] = seminf(fun, ntheta, x0, options, vlb, vub, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) 
%SEMINF Solves semi-infinite constrained optimization problems.
%	SEMINF solves problems of the form:
%
%		min { f(x) | g(x)<=0 | phi(x,w)<=0 | vlb<=x<=vub }
%          	 x
%	for all w in an interval. 
%
%	X=SEMINF('FUN',N,X0) starts at X0 and finds minimum to the function
%	constrained by N semi-infinite constraints in FUN (usually an M-file: FUN.M).
%	The function 'FUN' should return two arguments: a scalar value of the 
%	function to be minimized, F, a matrix of constraints, G,  and  N
%	semi-infinite constraints evaluated over an interval, PHI1, PHI2, ..: 
%	[F,G,PHI1,PHI2,...,PHIN,S]=FUN(X,S). 
%	F is minimized such that G < zeros(G), PHI1 < zeros(PHI1), ...
%	S is a recommended sampling interval which may or may not be used. 
%
%	X=SEMINF('FUN',N,X,OPTIONS) allows a vector of optional parameters to 
%	be defined. For more information type HELP FOPTIONS.
%	
%	X=SEMINF('FUN',N,X,OPTIONS,VLB,VUB) defines a set of lower and upper
%	bounds on the design variables, X, so that the solution is always in 
%	the range VLB < X < VUB. 
%	
%	Copyright (c) 1990 by the MathWorks, Inc.
%	Andy Grace 7-9-90.

%
%	X=SEMINF('FUN',N,X,OPTIONS,VLB,VUB,P1,P2,..) allows
%	coefficients, P1, P2, ... to be passed directly to FUN:
%	[...]=FUN(X,S,P1,P2,...). Empty arguments ([]) are ignored.


if nargin < 4, options=[]; end
if nargin < 5, vlb=[]; end
if nargin < 6, vub=[]; end
options = foptions(options);
options(7) = 5; 

fun2  =  '[f, g';
for i=1:ntheta
	fun2 = [fun2, ',t',int2str(i)];
end
fun2 = [fun2, ', s]=', fun '(x, s'];
for i=1:nargin - 6
                fun2 = [fun2,',P',int2str(i)];
end
fun2 = [fun2, ');'];

evalstr = [ '[f,g,NPOINT,NEWLAMBDA,OLDLAMBDA,LOLD,s] = semifun(x,LAMBDA,NEWLAMBDA,OLDLAMBDA, POINT, '''' ',fun2, ' '''',',int2str(ntheta),',FLAG,s'];
for i=1:nargin - 6
	evalstr = [evalstr, ',P', int2str(i)];
end
evalstr = [evalstr, ');'];

evalstr2 = ['[x,options] = constr('' ',evalstr,' '',x0,options,vlb,vub,[]'];
for i=1:nargin - 6
	evalstr2 = [evalstr2, ',P', int2str(i)];
end
evalstr2 = [evalstr2, ');'];

eval(evalstr2)

⌨️ 快捷键说明

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