How can I plot this 2nd order ode?

68 Views Asked by At

How can I plot the solution curves for this ode:

$y''-4y'+5y=0$

$y(-1)=2$

$y'(-1)=0$

I solved the ode but cannot solve for C1 and C2. Thanks.

2

There are 2 best solutions below

0
On

A sketch is like this

enter image description here

with MATLAB code

n=3;

x=0:0.01:pi;

for i=1:n

for j=1:n

    y=exp(2.*x).*(i.*sin(x)/10+j.*cos(x)/10);

    plot(x,y,'b')

    hold on

end

end
5
On

$y = C_1 e^{2t}\cos t + C_2 e^{2t} \sin t\\ y' = (2C_1 + C_2)\cos t + (2C_2-C_1)\sin t$

Now for your initial conditions.

$y(-1) = C_1 e^{-2}\cos (-1) + C_2 e^{-2} \sin (-1)=2\\ y'(-1) = (2C_1 + C_2)\cos (-1) + (2C_2-C_1)\sin (-1) = 0$

That is going to get messy...

Here is the trick:

$y = C_1 e^{2(t+1)}\cos (t+1) + C_2 e^{2(t+1)} \sin (t+1)$

Still satisfies your diff eq.

$y(-1) = C_1 =2\\ y'(-1) = 2C_1 + C_2= 0$