两个目标函数
f(1)=1.633+1591987*power(x(4),5.268)+12796*power(x(4),2)-40179.44*sin(x(3))/x(1)+40.83-1.755e-2/(tan(x(3))*x(7)*(1-x(1)*sqrt(1+power(x(3),2))/(pi*x(4)))+9174.45*sqrt(147-4.34e-5*power((23033*power(x(4),2)*(1-pi*sin(x(3))/x(1))-3.16e-2/(x(2)*tan(x(3))*(1-x(1)*sqrt(1+power(cot(x(3)),2))),2)-4.33e-8*(1/(power(x(2),2)*power(1-x(2)*sqrt(1+power(cot(x(6)),2))),2)-x(7)*sqrt(1+power(cot(x(3)),2))),2)*power(x(4),2))+2396366-5758.3*power(x(5),2))*(23033*power(x(4),2)*(1-pi*sin(x(3))/x(1))-3.16e-2/(x(2)*tan(x(3))*(1-x(1)*sqrt(1+power(cot(x(3)),2))),2)
f(2)=3e-8*power(x(5),-4)+1.06e-9/(power(x(2),2)*power(x(4),2)*power(1-x(1)*sqrt(1+power(cot(x(6)),2))),2)+564.08*power(x(5),2)
约束条件
4<x1<9,且x1取整数,5<x2<9, <x3< ,69<x4<86,20<x5<24, <x6< ,3<x2<5
请高手指教,集着用,谢谢啊

解决方案 »

  1.   

    function f=funy(x)
    f(1)=1.633+1591987*power(x(4),5.268)+12796*power(x(4),2)-40179.44*sin(x(3))/x(1)+40.83-1.755e-2/(tan(x(3))*x(7)*(1-x(1)*sqrt(1+power(x(3),2))/(pi*x(4)))+9174.45*sqrt(147-4.34e-5*power((23033*power(x(4),2)*(1-pi*sin(x(3))/x(1))-3.16e-2/(x(2)*tan(x(3))*(1-x(1)*sqrt((1+power(cot(x(3)))),2)))),2)-4.33e-8*(1/(power(x(2),2)*power(1-x(2)*sqrt(1+power(cot(x(6)),2))))),2)-x(7)*sqrt((1+power(cot(x(3)),2))),2))*power(x(4),2))+2396366-5758.3*power(x(5),2))*(23033*power(x(4),2)*(1-pi*sin(x(3))/x(1))-3.16e-2/(x(2)*tan(x(3))*(1-x(1)*sqrt(1+power(cot(x(3)),2))),2);
    f(2)=3e-8*power(x(5),-4)+1.06e-9/(power(x(2),2)*power(x(4),2)*power(1-x(1)*sqrt(1+power(cot(x(6)),2))),2)+564.08*power(x(5),2);
    A=[1,0,0,0,0,0,0;
    0,1,0,0,0,0,0;
    0,0,1,0,0,0,0;
    0,0,0,1,0,0,0;
    0,0,0,0,1,0,0;
    0,0,0,0,0,1,0;
    0,0,0,0,0,0,1];
    >> b=[9,9,2*pi/9,86,24,2*pi/9,5];
    >> x1=[1:9]x1 =     1     2     3     4     5     6     7     8     9>> goal=[0.001,0.001]';
    >> b=[9,9,2*pi/9,86,24,2*pi/9,5]';
    >> weight=abs(goal);
    >> lb=4,5,pi/9,69,20,5*pi/36,3]';
    ??? lb=4,5,pi/9,69,20,5*pi/36,3]';
                                   |
    Error: Unbalanced or misused parentheses or brackets.>> lb=[4,5,pi/9,69,20,5*pi/36,3]';
    >> x0=[10,10,10,10,10,10,10]';
    >> x=fgoalattain('f',x0,goal,weight,A,b,[],[],lb,[]);
    ??? Attempted to access x(8); index out of bounds because numel(x)=7.Error in ==> f at 2
    f(1)=10-0.0116*x(2)-0.0185*x(3)-0.0194*x(5)-0.0302*x(6)-0.1013*x(8)-0.0162*x(9);Error in ==> fgoalattain at 346
        user_f = feval(funfcn{3},x,varargin{:});>> options=optimset('LargeScale','off','Display','final','TolFun',1e-8,'TolX',1e-4);
    >> [x,fval]=fgoalattain(@funy,x0,goal,weight,A,b,x1,[],[],lb,[])
    ??? Error: File: funy.m Line: 2 Column: 400
    Expression or statement is incorrect--possibly unbalanced (, {, or [.Error in ==> fgoalattain at 346
        user_f = feval(funfcn{3},x,varargin{:});
    请高手指教,多谢!!!
      

  2.   

    以总损失最小和汽蚀余量最小为目标函数,其中x1位叶片数z,x2为叶片进口宽度b1,x3为叶片出口角β2,x4为叶轮出口直径D2,x5为叶轮进口直径D1,x6为叶片进口角β1,x7为叶片出口宽度b2
    4<x1<9,且x1取整数,5<x2<9, π/9<x3<2π/9 ,69<x4<86,20<x5<24, 5π/36<x6<2π/9 ,3<x7<5
    f1(X)=1.633+1591987x45.268+12796x42-40179.44×sinx3/z-0.01755/{x7×tanx3×[1-x1(1+cot2x3)0.5/πx4]}+40.83+9174.45【147-4.34×10-5×{23033×x42
    ×(1-πsinx3/x1)-3.16×10-2/[x7tanx3(1-x1(1+cot2x3)0.5/πx4]}2/x42-4.33×10-8
    ×{1/[x22×x52(1-x1(1+cot2x6)0.5/πx5)]-1/[x72×x42(1-x1(1+cot2x3)0.5/πx4)]}
    +2396366-5758.3x52】0.5×{23033×x42×(1-πsinx3/x1)-3.16×10-2/[x7tanx3(1-x1(1+cot2x3)0.5/(πx4)]}
    f2(X)=3.0×10-8×x5-4+1.06×10-9/{x22×x52[1-x1(1+cot2x6)0.5/πx5]2}+564.08x52