how to create a matrix with variables in it?
www.mathworks.com › matlabcentral › answersFeb 12, 2013 · The best answer to your question will likely depend on what you want to do with A. Sometimes, I find the following commands useful, which will create an anonymous function, A, that takes two inputs, x1 and x2 and returns the matrix you describe. Of course, this assumes you have values for the variables x1 and x2. A = @ (x1,x2) [x1,x1*x2;x1^2,x2^2]