Determinant of the Jacobian as a constraint couldn't avoid atan2(x,y) get into negative.
13 views (last 30 days)
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.
Alan Weiss on 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.
MATLAB mathematical toolbox documentation