Determinant of the Jacobian as a constraint couldn't avoid atan2(x,y) get into negative.
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt J
2022-4-12
编辑:Matt J
2022-4-12
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.
采纳的回答
Alan Weiss
2022-4-13
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!