matlab - lsqnonlin with complex equation systems -
i have 2 complex-nonlinear equations 2 complex variables (then 4 real variables). have tried use lsqnonlin instead of fsolve in order define boundaries (lb, ub) unknown variables.
options=optimset('display','iter','maxfunevals',1e6,'tolx',1e-16); fun = @myfun; x0 = [0,0,1000/2,100/2]; lb = [0,0,0,0]; ub = [1,1,1000,100]; x = lsqnonlin(fun,x0,lb,ub,options) my function has form:
function f=myfun(x) f(1) = a*x(3)+b*x(4)*1i - g1(x(1), x(2), x(3), x(4)); f(2) = c*x(3)+d*x(4)*1i - g2(x(1), x(2), x(3), x(4)); where a, b, c, d constant complex values, , g(x(1), x(2), x(3),x(4)) nonlinear function (with complex components too). after running lsqnonlin solver got error message: the levenberg-marquardt algorithm not handle bound constraints , trust-region-reflective algorithm requires @ least many equations variables; aborting.
first, not using levenberg-marquardt algorithm, dont think error because of that. then, makes me think lsqnonlin cannot handle complex equation systems, , maybe sees 2 equations (althought these 2 complex equations give 4 real equations solve 4 real variables (x(1), x(2), x(3), x(4)).
can write complex equations system while using lsqnonlin? doing wrong? appreciate can give me. lot in advance))
as stated in matlab documentation of lsqnonlin (limitations: third point, or search 'complex'), can use complex-valued problems without bound constraints. suggested, should split f real , imaginary part did complex variables.
fc(1) = a*x(3)+b*x(4)*1i - g1(x(1), x(2), x(3), x(4)); fc(2) = c*x(3)+d*x(4)*1i - g2(x(1), x(2), x(3), x(4)); f(1:2) = real(fc); f(3:4) = imag(fc);
Comments
Post a Comment