4

I want to call function handle model_jacobian, but i get "Error using ==> horzcat CAT arguments dimensions are not consistent.". When i pick function that leaves both a and d coefs in jacobian, everything works fine.

syms a d x;  
syms_function = a*x+d;                                                    
model_jacobian = matlabFunction(jacobian(syms_function, [a d]), 'vars', {[a d], x});
J = model_jacobian([1 1], [1 2 3 4 5 6 7 8 9]');

So how to call function handle with arguments despite the fact that they are not used there?

1
  • Replacing the unused argument with [] should work. Commented Sep 3, 2012 at 13:37

1 Answer 1

1

You've probably solved this, but you may want to reconsider your vars specification. The documentation says:

The value of this parameter must be either a cell array of strings or symbolic arrays, or a vector of symbolic variables

You have a cell array of symbolic variables, which does not seem correct. I would just keep it simple like:

'vars',[ a d x])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.