Determinant of the Jacobian as a constraint couldn't avoid atan2(x,y) get into negative.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've been trying to avoid singularity using determinant as a constraint. However, some anglar values obtained using atan2 () keep giving me the follwoing error message.
"Error using atan2 Inputs must be real."
while the determinant of the Jacobian is non-zero. This is because one of the input of atan2 is complex . Could this be related to matlab ? What function should I replace it with to scape from this trap? I believe, there is no singularity as long as the Jacobian has non-zero determinant.
Thanks
2 Kommentare
Matt J
am 12 Apr. 2022
Bearbeitet: Matt J
am 12 Apr. 2022
You have given us no information about the calculations you are doing, but I can say in general that no, a non-zero determinant is not usually a good way to ensure invertibility. For example, this matrix A has a non-zero determinant, but for numerical purposes, it is non-invertible.
A=[1,1;0 1e-20]; b=rand(2,1);
A\b
Also, every singular matrix has a non-singular matrix infinitely close to it,. So, if this is part of an iterative optimization problem, a non-singularity constraint cannot prevent the iterations from getting arbitrarily close to a singular solution.
Akzeptierte Antwort
Alan Weiss
am 13 Apr. 2022
While I do not know what you are really doing, you should know that nonlinear constraints are not satisfied at intermediate iterations. See Iterations Can Violate Constraints. That means your attempt to satisfy nonsingularity by including a nonlinear constraint is doomed to failure.
Instead, you should modify your objective function to be robust to infeasible points. Have the objective return NaN at these points, instead of getting into a situation where MATLAB throws an error.
Alan Weiss
MATLAB mathematical toolbox documentation
5 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Least Squares finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!