Jump to content

Backward Euler Method for 2x2 systems


mathmari

Recommended Posts

Hi!!!
I want to write a code in Matlab for the Backward Euler Method for 2x2 systems, using the fixed point iteration to find the yn+1.
y1n+1=y1n+h*f(tn+1,y1n+1,y2n+1) (1)
y2n+1=y2n+h*g(tn+1,y1n+1,y2n+1) (2)
Could you tell how I use the fixed point iteration??
At (1) the fixed point iteration will calculate y1n+1, y2n+1 will be calculated at (2) but it is already used in the equation (1) ...sad.png

Link to comment
Share on other sites

You need an initial guess. One approach is to use forward Euler for that first guess.

 

With this you obtain the simplest of the predictor/corrector class of integration techniques.

Link to comment
Share on other sites

No. You should treat those as simultaneous equations. That means you need an initial guess for [imath]y_1(n+1)[/imath] and for [imath]y_2(n+1)[/imath]. It also means that once you have a [imath]y_1(n+1), y_2(n+1)[/imath] pair you use that pair simultaneously to obtain the next iteration on [imath]y_1(n+1), y_2(n+1)[/imath].

 

Since forward Euler depends on initial value rather than end values, you can use forward Euler to obtain those initial guesses for the final values. Once you have those initial estimates for the end values, iterate with backward Euler until [imath]y_1(n+1), y_2(n+1)[/imath] have both converged to a stationary value.

Link to comment
Share on other sites

For the initial value problem y'(t)=f(t,y(t)), y(t0)=y0, the code is:

for n=1:N
t(n+1)=t(n)+h;
y(n+1)=y(n)+h*f(t(n+1),stage(y(n),h,t(n)));
end

where stage is a function that appreciates the fixed point iteration...

so for 2x2 systems, is the code:
for n=1:N
t(n+1)=t(n)+h;
[latex]y_{1}[/latex](n+1)=[latex]y_{1}[/latex](n)+h*f(t(n+1),stage([latex]y_{1}[/latex](n),h,t(n)),[latex]y_{2}[/latex](n+1)); (1)

[latex]y_{2}[/latex](n+1)=[latex]y_{2}[/latex](n)+h*f(t(n+1),[latex]y_{1}[/latex](n+1),stage([latex]y_{2}[/latex](n),h,t(n))); (2)
end

where at at the equation (1) I replace [latex]y_{2}[/latex](n+1) and at (2) the [latex]y_{1}[/latex] with the initail state???

Edited by mathmari
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.