Asked by Ed
on 10 Feb 2013

Hello,

I am trying to numerically solve a nonlinear complex equation and I would like to find all the complex roots. The equation is of the type:

cot(z)*z = 1-z^2*(1+i*z)

Does a specific function exist to find all the complex roots or do I need to separate z in the real and imaginary parts?

Thanks in advance for your help!

*No products are associated with this question.*

Answer by Matt J
on 10 Feb 2013

Edited by Matt J
on 10 Feb 2013

Accepted answer

If you have the Symbolic Math Toolbox, I think SOLVE can be used to get complex-valued solutions. For the numerical solvers, I'm pretty sure you do have to reformulate the problem in terms of real and complex parts. Also, I've never heard of a numerical solver that will robustly find multiple roots for anything except polynomials.

Show 8 older comments

Meng Li
on 20 Jul 2015

It seems there is no uploaded file. I will write down the equations.

Delta(eff)=4ac*Sum(1/n^2*tanh(alpha_n)/alpha_n+tanh(beta_n)/beta_n) (n is odd integer, it starts from 1 to infinity);

where

alpha_n=c/(2*Delta(a))*sqrt(1+(n*pi*Delta(c)/a)^2); beta_n=a/(2*Delta(c))*sqrt(1+(n*pi*Delta(a)/c)^2);

Walter Roberson
on 21 Jul 2015

You should start a new Question on this.

eff does not appear on the right hand side of your question so I do not know what the (eff) on the left relates to.

You define alpha_n and beta_n in terms of Delta(a) and Delta(c) but there is no obvious way of calculating either of those.

In your Delta(eff) formula, is 4ac = 4*a*c ?

Is alpha_n indicating alpha indexed at n?

Is the sum over odd n from 1 to infinity?

If Delta is being defined recursively (because it is defined in terms of alpha_n and beta_n that are defined in terms of Delta) then you need an initial condition.

Meng Li
on 21 Jul 2015

Delta(eff) is a experimentally measured value and this value can be separated into Delta(a) and Delta(c) through the first equation.

Yes. 4ac=4*a*c; Yes. alpha_n indicating alpha at n; Yes. the sum is over integer from 1 to infinity;

If I want to solve the equation, I should give some initial guess value for Delta(a) and Delta(c). Because the function 'fminsearch' can only give local solutions, I think the initial guess will be very important.

Answer by Azzi Abdelmalek
on 10 Feb 2013

Use fzero function

doc fzero

f=@(z)cot(z)*z -(1-z^2*(1+i*z)) z0=i; sol=fzero(f,z0); % the solution is near z0

Matt J
on 10 Feb 2013

It's interesting that this worked for z0=i, but it appears to be just a fluke. FZERO can't really handle complex-valued functions. Note,

>> sol=fzero(f,1+i) Error using fzero (line 309) Function value at starting guess must be finite and real.

Ed
on 10 Feb 2013

I tried the fsolve but unfortunately it seems to be related just to real functions. Thanks!

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments