MATLAB: Formula for the exact solution u1(u) and u2(t)

eigenvalues

I want to examine the system u´(t)=Au(t) for matrix A=[12 15; -10 -13] and startvalue u0=[3; -2]
I plotted the system with code:
A=[12 15;-10 -13];
u1=linspace(-3,2,20);u2=linspace(-3,2,20);
[U1,U2]=meshgrid(u1,u2);
F1=A(1,1)*U1+A(1,2)*U2;
F2=A(2,1)*U1+A(2,2)*U2;
quiver(U1,U2,F1,F2,1.5)
axis([-3 5 -3 3]), hold on
f=@(t,u)A*u;
u0=[3;-2];
[t,U]=ode45(f,[0 5],u0);
plot(U(:,1),U(:,2),'r','LineWidth',2)
but how do I find the formula for the exact solution u1(u) and u2(t)?

Best Answer

Hi,
try:
syms u1(t) u2(t)
A = [12 15; -10 -13];
cond = [u1(0) == 3; u2(0) == -2]
ode = [diff(u1,t); diff(u2,t)] == A * [u1; u2]
result = dsolve(ode, cond)
result_u1 = result.u1
result_u2 = result.u2
results are:
result_u1 =
3*exp(2*t)
result_u2 =
-2*exp(2*t)
Best regards
Stephan