# How to avoid using det, when looking for the complex root w with det(M(w)) = 0

2 views (last 30 days)
ma Jack on 6 Jul 2022
Commented: ma Jack on 12 Jul 2022
Hi all,
I want to find a complex number w such that det(M(w)) converges to 0 (note that M is a matrix and it is a function of w), but the det function seems to have a large error, how can I avoid using it?M is an 8*8 matrix, so it would be very complicated to write out its determinant expression.
ma Jack on 7 Jul 2022
Sir thank you for your suggestion, but I think Mr. Matt J's answer is better.

Matt J on 6 Jul 2022
Edited: Matt J on 7 Jul 2022
Because your matrix appears to be symmetric, I suggest minimizing instead norm(M(w)) which is the maximum absolute eigenvalue of M. This is the same as forcing M to be singular.
EDIT: rcond(M) is probably more appropriate than norm(M)
Additionally, I suggest using fminsearch instead of lsqnonlin, since you only have a small number of variables and a non-differentiable cost function. Be mindful, however, that you must express your objective function in terms of a vector z of real variables.
w=@(z) complex(z(1),z(2));
zopt=fminsearch(@(z) norm(M(w(z))) ,z0)
wopt=w(zopt)
ma Jack on 12 Jul 2022
Hi everyone, interested in following my latest issue?I encountered a very, very strange problem when using the fminsearch+rcond function(Same code, same computer, same matlab version, different running times and different results).

R2018b

### Community Treasure Hunt

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

Start Hunting!