Prev: how can I match all lines except empty ones?
Next: Creating IO Blocksets for an Embedded Target Device?
From: Venkataraman on 23 Jul 2010 09:35 Hi, i am trying to optimize 2 functions each having 5 variables. the code i wrote is as follows function f = edm(x) f(1) = 108.049 - 26.5842*x(1) + 0.801646*x(2) - 141.888*x(3) - 0.371658*x(4) + 0.0366417*x(5) + 2.83293*(x(1)^2) -(0.0469063*x(1)*x(2)) + (9.00625*x(1)*x(3)) - (0.000842188*x(1)*x(4)) + (0.0172187*x(1)*x(5))- (0.0000218018*(x(2)^2)) - (0.339688*x(2)*x(3)) - (0.000877344*x(2)*x(4)) - (0.000664063*x(2)*x(5)) + (116.293*(x(3)^2)) + (0.0942187*x(3)*x(4)) - (0.00809375*x(3)*x(5)) + (0.00119558*(x(4)^2)) + (0.000363281*x(4)*x(5)) - 0.00150518*(x(5)^2); f(2) =-[-0.985466 + (0.151912*x(1)) - (0.00642768*x(2)) + (3.08858*x(3)) - (0.000251344*x(4)) - (0.00216784*x(5)) - (0.0344143*(x(1)^2)) + (0.00035*x(1)*x(2)) + (0.02125*x(1)*x(3)) + (0.00114688*x(1)*x(4)) + (0.0000375*x(1)*x(5)) +(0.0000464643*(x(2)^2)) + (0.0020625*x(2)*x(3)) - (0.00000921875*x(2)*x(4)) + (0.00001125*x(2)*x(5))- (3.44143*(x(3)^2)) + (0.002375*x(3)*x(4)) - (0.0020625*x(3)*x(5)) - (0.0000121339*(x(4)^2)) + (0.00000859375*x(4)*x(5)) + (0.0000152143*(x(5))^2)]; Lower Bounds [3,30,0.4,-200,20] Upper bounds [5,70,0.6,-120,60] When i run the code, i get the following error In an assignment A(I) = B, the number of elements in B and I must be the same. But when i tried to remove a few terms from my function and shorten it, i was getting the pareto front without any problems. Clearly, this is not a solution to my problem. Any help or suggestions would be apprecated. when i run this code, i get the error message
From: Steven_Lord on 23 Jul 2010 09:58 "Venkataraman " <r.venkat0311(a)gmail.com> wrote in message news:i2c5qr$bhi$1(a)fred.mathworks.com... > Hi, > i am trying to optimize 2 functions each having 5 variables. the code i > wrote is as follows > function f = edm(x) > f(1) = 108.049 - 26.5842*x(1) + 0.801646*x(2) - 141.888*x(3) - > 0.371658*x(4) + 0.0366417*x(5) + 2.83293*(x(1)^2) -(0.0469063*x(1)*x(2)) > + (9.00625*x(1)*x(3)) - (0.000842188*x(1)*x(4)) + (0.0172187*x(1)*x(5))- > (0.0000218018*(x(2)^2)) - (0.339688*x(2)*x(3)) - (0.000877344*x(2)*x(4)) - > (0.000664063*x(2)*x(5)) + (116.293*(x(3)^2)) + (0.0942187*x(3)*x(4)) - > (0.00809375*x(3)*x(5)) + (0.00119558*(x(4)^2)) + (0.000363281*x(4)*x(5)) - > 0.00150518*(x(5)^2); > f(2) =-[-0.985466 + (0.151912*x(1)) - (0.00642768*x(2)) + > (3.08858*x(3)) - (0.000251344*x(4)) - (0.00216784*x(5)) - > (0.0344143*(x(1)^2)) + (0.00035*x(1)*x(2)) + (0.02125*x(1)*x(3)) + > (0.00114688*x(1)*x(4)) + (0.0000375*x(1)*x(5)) +(0.0000464643*(x(2)^2)) + > (0.0020625*x(2)*x(3)) - (0.00000921875*x(2)*x(4)) + > (0.00001125*x(2)*x(5))- (3.44143*(x(3)^2)) + (0.002375*x(3)*x(4)) - > (0.0020625*x(3)*x(5)) - (0.0000121339*(x(4)^2)) + > (0.00000859375*x(4)*x(5)) + (0.0000152143*(x(5))^2)]; Since you're assigning the output of this computation to f(2), the right-hand side must be a scalar. Remove the square brackets (or if you need them for grouping, replace them with parentheses.) -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Venkataraman on 23 Jul 2010 13:40
"Venkataraman " <r.venkat0311(a)gmail.com> wrote in message <i2c5qr$bhi$1(a)fred.mathworks.com>... > Hi, > i am trying to optimize 2 functions each having 5 variables. the code i wrote is as follows > function f = edm(x) > f(1) = 108.049 - 26.5842*x(1) + 0.801646*x(2) - 141.888*x(3) - 0.371658*x(4) + 0.0366417*x(5) + 2.83293*(x(1)^2) -(0.0469063*x(1)*x(2)) + (9.00625*x(1)*x(3)) - (0.000842188*x(1)*x(4)) + (0.0172187*x(1)*x(5))- (0.0000218018*(x(2)^2)) - (0.339688*x(2)*x(3)) - (0.000877344*x(2)*x(4)) - (0.000664063*x(2)*x(5)) + (116.293*(x(3)^2)) + (0.0942187*x(3)*x(4)) - (0.00809375*x(3)*x(5)) + (0.00119558*(x(4)^2)) + (0.000363281*x(4)*x(5)) - 0.00150518*(x(5)^2); > f(2) =-[-0.985466 + (0.151912*x(1)) - (0.00642768*x(2)) + (3.08858*x(3)) - (0.000251344*x(4)) - (0.00216784*x(5)) - (0.0344143*(x(1)^2)) + (0.00035*x(1)*x(2)) + (0.02125*x(1)*x(3)) + (0.00114688*x(1)*x(4)) + (0.0000375*x(1)*x(5)) +(0.0000464643*(x(2)^2)) + (0.0020625*x(2)*x(3)) - (0.00000921875*x(2)*x(4)) + (0.00001125*x(2)*x(5))- (3.44143*(x(3)^2)) + (0.002375*x(3)*x(4)) - (0.0020625*x(3)*x(5)) - (0.0000121339*(x(4)^2)) + (0.00000859375*x(4)*x(5)) + (0.0000152143*(x(5))^2)]; > > Lower Bounds [3,30,0.4,-200,20] > Upper bounds [5,70,0.6,-120,60] > > When i run the code, i get the following error > In an assignment A(I) = B, the number of elements in B and > I must be the same. > > But when i tried to remove a few terms from my function and shorten it, i was getting the pareto front without any problems. Clearly, this is not a solution to my problem. Any help or suggestions would be apprecated. > > when i run this code, i get the error message thanks a ton steve lord, running perfectly ok now.. |