Ploting solutions to linear equations
Show older comments
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')
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!