# How to get comlex root of an equation using fminbnd?

3 visualizzazioni (ultimi 30 giorni)
Sina Jafari Ghalekohneh il 1 Feb 2023
Modificato: Matt J il 1 Feb 2023
I am trying to solve an equation using fminbnd. I need the complex answers of the equation but fminbnd only gives me the real part. Is there any way to force the fminbnd to give the comlex roots of the equation? I apprecite it if anyone could help me on this!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Tushar Behera il 1 Feb 2023
Hi Sina,
I believe you want to find the minimum of a function in the complex plane.
The function "fminbnd" is not suitable for such a task, you can use heuristic algorithms such as genetic algorithm or particle swarm optimization for such a task. Apart from that the following Matlab answer also sheds some light on this particular problem,
I hope this resolves your query.
Regards,
Tushar
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Matt J il 1 Feb 2023
Modificato: Matt J il 1 Feb 2023
fminbnd is for minimzing over a 1D interval. It's not clear to me how you are defining 1D interval bounds for a number that does not live on the real axis.
If you move to fminsearch, you can make it work by redefining your objective function fun() to work with the real and imaginary parts of the complex number as if they formed a 2D vector:
fun=@(x) fun( complex(x(1), x(2)) );
xopt = fminsearch(fun, [real(x0), imag(x0)])
xopt=complex(xopt(1),xopt(2));
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Solver Outputs and Iterative Display in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by