Inner matrix dimensions must agree but how when adding four or more predictor variables?
4 views (last 30 days)
Show older comments
I'm trying to see how joint angles of the right leg (predictor variables, X = x1, x2, x3 for the hip, knee, and ankle angles respectively each a [1 x 20] array) could potentially stablise the position of the right foot (outcome variables Y = x,y coordinate positions: both a [1 x 20] array) using multiple linear regression.
"dev" (a [1 x 20] array for each predictor variable) is the deviations of joint angles from the mean joint angle configuration at each trial and projected onto the null-space or null(J)(Z = null(J)) using the following code:
for i = 1:N
UCM(:,i) = (Z'*dev(:,i))*Z;
end
The UCM is used to look at the control of a movement and is approximated linearly using the null space (Z) of the J matrix.
This code works for one frame (i.e. a [1 x 20] array) and a whole normalised movement cycle (i.e. a [101 x 20] array) for 3 predictor varibles (PV's) and 2 output variables (OV's) from a [3 x 1] Z array.
However when I increase the number of PV's to 4 (resulting in a [4 x 2] Z array) and 5 (resulting in a [5 x 2] Z array) with 2OV's, I get the following warning:
???Error using mm>mtimes
Inner matrix dimensions must agree
Therefore, i'm unable to analyse any data above three PV's.
Any help would be appreciated.
0 Comments
Accepted Answer
See Also
Categories
Find more on Linear Regression 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!