- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
We consider the initial value problem:
$$x'(t)=-5x(t)-2y(t), t \in [0,1] \\ y'(t)=-2x(t)-100y(t), t \in [0,1] \\ x(0)=1, y(0)=1.$$
I want to solve the above problem using the forward Euler method, the trapezoid method and the backward Euler method and to represent in common graphs the corresponding values of $(x^n)^2+(y^n)^2$.
First of all, the formula for the approximation $y$ that we have using the backward Euler method is the following, right?
[m]y=inv(eye(2)-h*A)*y [/m]
where [m]A=[-5 -2;-2 -100][/m], right?
Then, I get the following graph for the approximations $(x^n)^2+(y^n)^2$.
View attachment 8113
The graphs are approximately the same, aren't they?
How can we deduce from this graph which method is better? (Thinking)
We consider the initial value problem:
$$x'(t)=-5x(t)-2y(t), t \in [0,1] \\ y'(t)=-2x(t)-100y(t), t \in [0,1] \\ x(0)=1, y(0)=1.$$
I want to solve the above problem using the forward Euler method, the trapezoid method and the backward Euler method and to represent in common graphs the corresponding values of $(x^n)^2+(y^n)^2$.
First of all, the formula for the approximation $y$ that we have using the backward Euler method is the following, right?
[m]y=inv(eye(2)-h*A)*y [/m]
where [m]A=[-5 -2;-2 -100][/m], right?
Then, I get the following graph for the approximations $(x^n)^2+(y^n)^2$.
View attachment 8113
The graphs are approximately the same, aren't they?
How can we deduce from this graph which method is better? (Thinking)