using matlab
write separate function bwdEulerFPI
present figure with backward Euler approximation and exact
solution to IVP
add legend
For this problem, you will build a Matlab function that will implement backward Euler's method by solving (approximately) a fixed-point problem at every step. On a separate file, write the function with definition function [w] = budEulerFPI(f, a, b, b, tol) a which should have the following: a, b Input 1 : the source term of the ODE ft,y), function of two variables • the left and right boundary of the domain of t respectively : the spacing of evenly-spaced nodes to be used in [a, b], including a and b • the tolerance to be used for the stopping condition of fixed-point iteration (see details below) Output v : the backward Euler's approximations to (yi) - with Wi 2 yi - y(ti), i - 0,...,n h tol The backward Euler's method for the Initial Value Problem y' ya) ft, y) ya astab is defined as wo ya Wi+1 W: + hfſti+1, 4+1), i - 0,...,n-1 Your function should evaluate Wi+1 as the approximate solution to the fixed-point problem $(x) = x, where $(x) – Wi + hf(ti+1,x) by applying fixed-point iteration with initial guess wi, and stopping condition | wu) - wil< tol. In your prob2(): Call your budEulerFPI function for the IVP y' - cosy+t), y(0) 0 0<t<1 with h - 0.1, tol - 10-6 Output: (a) Present a figure with your backward Euler approximation. (b) In the same figure, plot the exact solution of the IVP, y(t) = 2 arctant-t. (c) Add a legend to your figure.
using matlab write separate function bwdEulerFPI present figure with backward Euler approximation and exact solution to
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
using matlab write separate function bwdEulerFPI present figure with backward Euler approximation and exact solution to
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!