How to correct "Undefined function 'mtimes' for input arguments of type 'cell'."

I am trying to estimate parameters of some ODEs that describe the velocity vector of a wheeled mobile robot using the system identification toolbox. Specifically, I am trying to solve a non linear grey box model to find these parameters.
When I run the model I get the following error:
Error using iddata/nlgreyest
Error or mismatch in the specified ODE file "threewheeledomni_modelFile."
The error message is: "Undefined function 'mtimes' for input arguments of type 'cell'."
Here is the code for the ODE, the other file is too much to copy in here:
function[dx,y] = threewheelomni_modelFile(t,x,u,alpha1,alpha2,alpha3,beta1,beta2,beta3,gamma1,gamma2,gamma3,l,r,varargin)
alpha=[alpha1,alpha2,alpha3];
beta =[beta1,beta2,beta3];
gamma=[gamma1,gamma2,gamma3];
y=x;
rotMat = [cos(x(3)),-sin(x(3)),0;sin(x(3)),cos(theta0),0;0,0,1];
J1 = [sin(alpha(1)+beta(1)+gamma(1)),-cos(alpha(1)+beta(1)+gamma(1)),-l*cos(beta(1)+gamma(1));...
sin(alpha(2)+beta(2)+gamma(2)),-cos(alpha(2)+beta(2)+gamma(2)),-l*cos(beta(2)+gamma(2));...
sin(alpha(3)+beta(3)+gamma(3)),-cos(alpha(3)+beta(3)+gamma(3)),-l*cos(beta(3)+gamma(3))];
J2 = [r*cos(gamma1),0,0;0,r*cos(gamma2),0;0,0,r*cos(gamma3)];
dx = inv(rotMat)*inv(J1)*J2*u;

2 Comments

Nope, the code in the zip you attached starts
function[dx,y] = threewheelomni_modelFile(t,x,u,theta0,alpha1,alpha2,alpha3,beta1,beta2,beta3,gamma1,gamma2,gamma3,l,r,varargin)
with theta0 before the alpha1
Correct. Im saying that was a mistake on my part. theta0 shouldnt have been a fixed parameter, its a variable. I updated the code such that theta0 is calculated from an integral function of x(3) now I'm rolling along ok. Its also possible I attached mismatched files. Thanks for the response, you helped me solve this one by highlighting that detail.

Sign in to comment.

 Accepted Answer

The mlx constructs 11 parameters starting from alpha1 . However the modelFile expects 12 parameters starting from theta0

1 Comment

theta0 should have been the 3rd element of the state vector. Silly question, sorry about that.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!