- #1
yaang
- 23
- 0
Matlab question about equality check, decimals
Complete code is attached as an .m file
Code basically finds the inverse kinematics of a 2 part robot arm. There should be 4 mathematical solutions and 2 of these solution should physically solve this system. Problem is one of the correct solutions(3rd solution) find the Py value to be 2.49999999999 where it should be 2.50000000. How can i find out where this error is coming from and how can i fix it ?
My code checks if the Py value is 2.5 and since it isn't according to MATLAB (it should be exactly 2.5 i don't understand why MATLAB thinks otherwise) it returns false. Any way around this problem will be appreciated.
Complete code is attached as an .m file
Code basically finds the inverse kinematics of a 2 part robot arm. There should be 4 mathematical solutions and 2 of these solution should physically solve this system. Problem is one of the correct solutions(3rd solution) find the Py value to be 2.49999999999 where it should be 2.50000000. How can i find out where this error is coming from and how can i fix it ?
My code checks if the Py value is 2.5 and since it isn't according to MATLAB (it should be exactly 2.5 i don't understand why MATLAB thinks otherwise) it returns false. Any way around this problem will be appreciated.
Attachments
Last edited: