| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2009-04-14 
				
				年龄: 43 
				
					帖子: 3
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			目标函数myfun 
		
		
		
			function f=myfun(x) f=0.00004717/(x(1)*x(2)+x(1)*x(3)+x(3))+0.059825+0.00595/(x(1)*x(5)+x(1)*2*sqrt(x(4)^2+(x(2)/2-x(5)/2)^2)); mycon1函数 function [c,ceq] = mycon1(x) c(1) = -x(2)+ x(5); ceq(1) = x(1)*x(2)+x(1)*x(3)+x(3)-0.006; 主程序代码 lbM=[10 5e-5 5e-6 5e-5 0]; ubM=[300 1e-3 1e-3 1e-3 1e-3]; options = optimset('GradConstr', 'on'); x0=[10 5e-4 8e-4 5e-4 5e-4]; %x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options) [x,fval] = fmincon('myfun2',x0,[],[],[],[],lbM,ubM,mycon1,options); 运行后出现如下问题: ??? Input argument "x" is undefined. Error in ==> mycon1 at 2 c(1) = -x(2)+ x(5); 请教高手帮忙解决。 此帖于 2009-04-14 20:03 被 china_ie 编辑。  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 |