Rubron
unread,Apr 6, 2017, 9:59:07 AM4/6/17You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi, I have two complex-nonlinear equations with two complex variables (then four real variables). I have tried to use lsqnonlin instead of fsolve in order to define boundaries (lb, ub) to my 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 this form:
function F=myfun(x)
F(1) = a*x(3)+b*x(4)*1i - G(x(1), x(2), x(3), x(4));
F(2) = c*x(3)+d*x(4)*1i - G(x(1), x(2), x(3), x(4));
where a, b, c, d are constant complex values, and G(x(1), x(2), x(3),x(4)) is a nonlinear function (with complex components too). After running lsqnonlin solver I got this error message: "The Levenberg-Marquardt algorithm does not handle bound constraints and the trust-region-reflective algorithm requires at least as many equations as variables; aborting."
First, I am not using Levenberg-Marquardt algorithm, so I dont think the error is because of that. Then, it makes me think that lsqnonlin cannot handle complex equation systems, and maybe it only sees two equations (althought these two complex equations give four real equations to solve my four real variables (x(1), x(2), x(3), x(4)).
Can I write complex equations system while using lsqnonlin? am I doing something wrong? I really would appreciate very much any help you can give me. Thanks a lot in advance))