inline matrix n x n input

hi guys I'm writing a program that uses the jacobian of a matrix, but whenever I input it using "inline" command it does not work. can someone help?
ex: i want to input the 2 by 2 matrix [2*x1 x2; 1.5*x3 x4]
but if i use f = inline('[2*x1 x2; 1.5*x3 x4]'); it gives me an error.
and if i use f = inline('2*x1 x2; 1.5*x3 x4'); then it's not a 2 by 2 matrix

 채택된 답변

themaze
themaze 2013년 4월 11일

0 개 추천

The input argument to the inline function is automatically determined by searching expr for an isolated lower case alphabetic character, other than i or j, that is not part of a word formed from several alphabetic characters.
So in essence you cannot use x1 or x2 ....
You may want to try an anonymous function instead.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

태그

질문:

2013년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by