MATLAB非线性规划用fmincon,目标函数参数较多,其中级数求和中又含参数,该怎么处理?跪求,附目标函数 15
functionf=myfun(x)t=fix(8*(-0.5*x(1)/450-11*0.5/9+20/9))+fix(10*(-0.5*x(2)/450-11*0.5...
function f=myfun(x)
t=fix(8*(-0.5*x(1)/450-11*0.5/9+20/9))+fix(10*(-0.5*x(2)/450-11*0.5/9+20/9))+fix(12*(-0.5*x(3)/450-11*0.5/9+20/9))...
+fix(14*(-0.5*x(4)/450-11*0.5/9+20/9))+fix(16*(-0.5*x(5)/450-11*0.5/9+20/9))+fix(18*(-0.5*x(6)/450-11*0.5/9+20/9))...
+fix(20*(-0.5*x(7)/450-11*0.5/9+20/9))+fix(22*(-0.5*x(8)/450-11*0.5/9+20/9))+fix(24*(-0.5*x(9)/450-11*0.5/9+20/9))+fix(28*(-0.5*x(10)/450-11*0.5/9+20/9));
a=0;
b=t-150;
c=0;
d=t;
%symsum(expr,k,a,b)
syms g
syms k
g=(t-k-150)*1000*nchoosek(t,k)*(0.05^k)*(0.95^(t-k));
T=symsum(g,k,a,b);
%symsum(expr,k,c,d)
syms y
syms k
y=k*500*nchoosek(t,k)*(0.05^k)*(0.95^(t-k));
S=symsum(y,k,c,d);
f=-(x(1)*fix(8*(0.5*x(1)/450+11*0.5/9-11/9))+x(2)*fix(10*(0.5*x(2)/450+11*0.5/9-11/9))+x(3)*fix(12*(0.5*x(3)/450+11*0.5/9-11/9))...
+x(4)*fix(14*(0.5*x(4)/450+11*0.5/9-11/9))+x(5)*fix(16*(0.5*x(5)/450+11*0.5/9-11/9))+x(6)*fix(18*(0.5*x(6)/450+11*0.5/9-11/9))...
+x(7)*fix(20*(0.5*x(7)/450+11*0.5/9-11/9))+x(8)*fix(22*(0.5*x(8)/450+11*0.5/9-11/9))+x(9)*fix(24*(0.5*x(9)/450+11*0.5/9-11/9))...
+x(10)*fix(28*(0.5*x(10)/450+11*0.5/9-11/9)))+symsum(g,k,a,b)+symsum(y,k,c,d); 展开
t=fix(8*(-0.5*x(1)/450-11*0.5/9+20/9))+fix(10*(-0.5*x(2)/450-11*0.5/9+20/9))+fix(12*(-0.5*x(3)/450-11*0.5/9+20/9))...
+fix(14*(-0.5*x(4)/450-11*0.5/9+20/9))+fix(16*(-0.5*x(5)/450-11*0.5/9+20/9))+fix(18*(-0.5*x(6)/450-11*0.5/9+20/9))...
+fix(20*(-0.5*x(7)/450-11*0.5/9+20/9))+fix(22*(-0.5*x(8)/450-11*0.5/9+20/9))+fix(24*(-0.5*x(9)/450-11*0.5/9+20/9))+fix(28*(-0.5*x(10)/450-11*0.5/9+20/9));
a=0;
b=t-150;
c=0;
d=t;
%symsum(expr,k,a,b)
syms g
syms k
g=(t-k-150)*1000*nchoosek(t,k)*(0.05^k)*(0.95^(t-k));
T=symsum(g,k,a,b);
%symsum(expr,k,c,d)
syms y
syms k
y=k*500*nchoosek(t,k)*(0.05^k)*(0.95^(t-k));
S=symsum(y,k,c,d);
f=-(x(1)*fix(8*(0.5*x(1)/450+11*0.5/9-11/9))+x(2)*fix(10*(0.5*x(2)/450+11*0.5/9-11/9))+x(3)*fix(12*(0.5*x(3)/450+11*0.5/9-11/9))...
+x(4)*fix(14*(0.5*x(4)/450+11*0.5/9-11/9))+x(5)*fix(16*(0.5*x(5)/450+11*0.5/9-11/9))+x(6)*fix(18*(0.5*x(6)/450+11*0.5/9-11/9))...
+x(7)*fix(20*(0.5*x(7)/450+11*0.5/9-11/9))+x(8)*fix(22*(0.5*x(8)/450+11*0.5/9-11/9))+x(9)*fix(24*(0.5*x(9)/450+11*0.5/9-11/9))...
+x(10)*fix(28*(0.5*x(10)/450+11*0.5/9-11/9)))+symsum(g,k,a,b)+symsum(y,k,c,d); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询