Unable to run pinv (Moore Penrose) , get errors
4 views (last 30 days)
Show older comments
Tried the following script:
r0=[0,0,0];
dq=double(pinv(J_BF_inB)*(rGoal-r0));
dq=double(subs(dq,[alpha,beta,gamma],[0,0.52,1.04]));
q=q0;
for n=1:10
q=q+dq;
end
I get the following errors:
Error using svd
First input must be single or double.
Error in pinv (line 18)
[U,s,V] = svd(A,'econ');
Error in solution (line 24)
dq=double(pinv(J_BF_inB)*(rGoal-r0));
2 Comments
Answers (1)
Walter Roberson
on 12 Feb 2022
You cannot take the pseudo-inverse of a function handle.
If you were to construct a symbolic array you might be able to pinv() that, but you would not be able to double() the results.
Are you expecting that the 3x3 matrix might not have full rank? If full rank is expected then this would look more like a job for the \ operator
12 Comments
Walter Roberson
on 14 Feb 2022
It helps solve your problem by pointing out where you went wrong on constructing the matrix.
It continues from there in stating that if you put in an arbitrary value for the 2nd or 3rd element of the middle row of the matrix (the one that is missing an element) then you get a singularity when you substitute alpha = 0, which makes it less likely (but not impossible) that the missing element is in the second or third position.
It then shows that if you put an arbitrary value as the first element of the second row, so that you can get out a 3 x 3 matrix, then you can calculate pinv(J_BF_inB)*(rGoal-r0) and then substitute in alpha, beta, gamma values .
How does it help you solve your overall question? Well it helps you debug the problem and shows you the kind of operations that can be done.
Does it solve the overall problem? Certainly not. As I have been explaining to you, your approach is wrong. Over in https://www.mathworks.com/matlabcentral/answers/1648515-unable-to-run-pinv-moore-penrose-with-accuracy-limit#answer_895320 I described the steps you need to take.
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!