Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a script in matlab for the following PROBLEM. DO NOT GIVE GENERAL SOLUTION TO ODE, must give numerical approximation. NUMERICAL ANALYSIS! Problem 1 (Numerical
write a script in matlab for the following PROBLEM. DO NOT GIVE GENERAL SOLUTION TO ODE, must give numerical approximation. NUMERICAL ANALYSIS!
Problem 1 (Numerical solution of a ODE). Consider the following scalar ordinary differential equation ODE): z'(t) =-x(t), 2 For this particular equation, we know the exact solution: it corresponds to the exponential growth r(t) - e Implement codes for the following methods: the explicit Euler method, the implicit Euler method, the (implicit) trapezoidal (Crank-Nicolson) method, the (implicit) BDF-2 method. For this method, you need to bootstrap in the first time step; use the Crank-Nicolson method for this Then compute approximations to x 4) using each of four methods and with step sizes ?t 21, T, . . . . T. Compute their respective errors e = IxN-x(4)| where xN s the approximation to x(4) at the end of the last time step. For each method, create either a table or a At-vs-e graph that shows how the error decreases as the mesh size is reduced. (For the graph, you will want to consider a log-log plot.) In all cases, the error should behave as e ~ C ?ts for some C that we would like to be as small as possible, and an s that we would like to be as large as possible. Determine both C and s from your data Discuss which method yields the most accurate answer. (40 points) Problem 1 (Numerical solution of a ODE). Consider the following scalar ordinary differential equation ODE): z'(t) =-x(t), 2 For this particular equation, we know the exact solution: it corresponds to the exponential growth r(t) - e Implement codes for the following methods: the explicit Euler method, the implicit Euler method, the (implicit) trapezoidal (Crank-Nicolson) method, the (implicit) BDF-2 method. For this method, you need to bootstrap in the first time step; use the Crank-Nicolson method for this Then compute approximations to x 4) using each of four methods and with step sizes ?t 21, T, . . . . T. Compute their respective errors e = IxN-x(4)| where xN s the approximation to x(4) at the end of the last time step. For each method, create either a table or a At-vs-e graph that shows how the error decreases as the mesh size is reduced. (For the graph, you will want to consider a log-log plot.) In all cases, the error should behave as e ~ C ?ts for some C that we would like to be as small as possible, and an s that we would like to be as large as possible. Determine both C and s from your data Discuss which method yields the most accurate answer. (40 points)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started