Question: Optimizing


saqib 24 Maple
I am trying to optimize a function using NLPSolve. The function is in Matlab and Maple calls the function and optimizes it. The values that I am getting are not correct. The optimal values of the parameters are outside the range tha I specify and the function value is not what should correspond to these optimal values. I have attached both the Maple and Matlab codes herewith. Looking forward to your help. Maple File: restart; Matlab:-evalM("cd 'c:/documents and settings/user/my documents'"); mat2map5 := proc (a, b) local Res, res; Matlab:-setvar("a", a); Matlab:-setvar("b", b); Matlab:-evalM("result = mat2map6(a,b)"); Res := (Matlab:-getvar)("result"); res := convert(Res, float); return res end proc; mat2map5(5, 3) Optimization:-NLPSolve(mat2map5, 0 .. 1, 0 .. 1) Matlab Code: function[result]=mat2map6(a,b) result=a^2+b^2; end
Please Wait...