# Finding Complex root for the nonlinear equation with single variable

21 views (last 30 days)
Ammar Ahmed on 12 Oct 2019
Answered: Walter Roberson on 17 Oct 2019
function Sp = f(y)
c=[0.00974404439034699,0.00984082551153513,0.00991280676795526];
t=[1.40,1.70,1.90];
x1=(6+2.3*10^5*1i);
x2=(7+3*10^-9*1i);
A1=(y-x1)./(x1-2.*y); % the single variable is y in the equation
B1=(y-x2)./(x2-2.*y);
Sp=((t.*A1)./(1+c.*A1)+((1-t).*B1)./(1+c.*B1));
end
hi guys , I'm searching for solution for the mention equation , so that it would have two solution in such way one solution is correct and the other is not !!!!!
((t.*A1)./(1+c.*A1)+((1-t).*B1)./(1+c.*B1))=0 the nonlinear equation
any suggestion method to solve the roots for this equation !!!

#### 1 Comment

John D'Errico on 17 Oct 2019
Please don't use an answer to make a comment. Moved to a comment:
"this was not helping at all!!! can i solve it with fzero"

Walter Roberson on 17 Oct 2019
There is no fzero() command that can work. You have a vector of 3 equations that are inconsistent with each other. And if you were to break it up into three different equations, then you would encounter the problem that fzero() can only deal with real-valued functions of a single real-valued variable.
fsolve() can deal with complex valued functions.
A standard trick to convert complex inputs into real inputs is to separate into real and imaginary components, such as
f2 = @(x) x.^2 + 1;
f = @(x) f2(x(1) + 1i*x(2));
fsolve(f, ....)

Sulaymon Eshkabilov on 12 Oct 2019
Hi Ammar,
Since your exercise is a nonlinear equation and thus, it is more appropriate to employ Newton-Raphson method for that you would need to evalaute the derivative of your equation and then solve the system numerically based on Newton-Raphson technique.
Good luck.

John D'Errico on 17 Oct 2019
But the answer is, not you cannot use fzero to find a complex root. fzero ONLY solves for real roots.

Walter Roberson on 17 Oct 2019
Your function returns three outputs for each input y, and the three outputs each have two complex solutions. There is no single value of y that solves all three values at the same time.

Ammar Ahmed on 17 Oct 2019
Walter Roberson can you share the fzero command you suggest to use