mathmari Posted May 27, 2013 Share Posted May 27, 2013 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) ... Link to comment Share on other sites More sharing options...
D H Posted May 27, 2013 Share Posted May 27, 2013 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. 1 Link to comment Share on other sites More sharing options...
mathmari Posted May 27, 2013 Author Share Posted May 27, 2013 Do you mean that at the equation (1) I use the fixed point iteration for the y1n+1 and that I replace y2n+1 with the value of forward Euler??? Link to comment Share on other sites More sharing options...
D H Posted May 27, 2013 Share Posted May 27, 2013 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. 1 Link to comment Share on other sites More sharing options...
D H Posted May 28, 2013 Share Posted May 28, 2013 Addendum to my last post: Even simpler than using forward Euler for that initial guess is to simply use the initial state. 1 Link to comment Share on other sites More sharing options...
mathmari Posted May 28, 2013 Author Share Posted May 28, 2013 (edited) 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))); endwhere 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) endwhere 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 May 28, 2013 by mathmari Link to comment Share on other sites More sharing options...
D H Posted May 28, 2013 Share Posted May 28, 2013 No. You aren't doing fixed point iteration here, and you aren't touching y2. 1 Link to comment Share on other sites More sharing options...
mathmari Posted May 30, 2013 Author Share Posted May 30, 2013 Ok!! Thank you...!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now