MATLAB: Ploting solutions to linear equations

ode

Consider the linear system of equations x' = Ax. Let x(t)=[x1(t), x2(t), x3(t)]T be the unique solution such that x(0) = v1. In the same figure, I want to plot plot each of the functions x1(t), x2(t) and x3(t). I dont think I should have to use ODE 45. I have already looked on the matlab website to no avail.
M = [7 7 7; 2 6 7; 4 3 1];
B = transpose(M);
A = M+B;
[V,D]=eig(A);
lambda1= -5.9049;
v1= [-0.3429 -0.3208 0.8829];
% part c
syms x(t) y(t) % I use x(t) and y(t) to represent x1' and x2'
Y = [x; y];
odes = diff(Y) == A*Y %matlab keeps saying there is a problem with this line and I dont know why
[xSol(t), ySol(t)] = dsolve(odes);
xSol(t) = simplify(xSol(t));
ySol(t) = simplify(ySol(t));
C = Y(0) == [-0.3429 -0.3208 0.8829];
[xSol(t), ySol(t)] = dsolve(odes,C)
clf
fplot(ySol)
hold on
fplot(xSol)
grid on
savefig('symmetric.fig')

Best Answer

The ‘A*Y’ operation attempts to multiply (3x3) matrix ‘A’ by a (2x1) vector ‘Y’. That will just never work!
The ‘Y’ vector must be (3x1) to do that multiplication.