MATLAB: ‘subs’ not working as i want

MATLABmatrixsubs

Hello guys,
I have this equation -x^2/2 + 2*x – (5*I)/2 and I'm trying to replace the letter x with a the matrix A and the letter I with the matrix B.
A = 0 1 0
0 0 1
2 -5 4
B = eye(3)
The problem is that when I write subs(eq, x, A) and subs(eq, I, eye(3)) I get a very big matrix, and this is not the answer.

Best Answer

Do both subs at the same time
subs(eq, {x, I}, {A, eye(3)})