matlabroboticsinversekinematics

Making Dataset for 4 Motors Inverse kinematics using ANFIS in MATLAB


This is the link that explain to solve inverse kinematics using ANFIS http://www.mathworks.com/help/fuzzy/examples/modeling-inverse-kinematics-in-a-robotic-arm.html

But the example is only for 2 DOFs Robot. How to make the data set if the robot using 4 motors? Because there is always an error that says :"Error using meshgrid. Too many input arguments." when running the code:

a= 0:(1*pi/180):(180*pi/180);
b= 0:(1*pi/180):(180*pi/180);
c= 0:(1*pi/180):(180*pi/180);
d= (25*180/pi):(1*pi/180):(180*pi/180);

[THETA1, THETA2, THETA3, THETA4] = meshgrid(a, b, c, d);

Any Suggestion will be appreciated Thanks!


Solution

  • meshgrid is specifically for 2D or 3D data. For arbitrary n-dimensional data, the appropriately-named ndgrid is the guy you want.

    Note that meshgrid is intended for working intuitively with Cartesian X,Y{,Z} data, so swaps the first two dimensions in the shape of its output to reflect X,Y order rather than row,column. ndgrid, being more general, just gives you standard multidimensional matrix order.