2 consider the equation for the domain a obtain an analytical solution
Question
2. Consider the equation for the domain
(a) Obtain an analytical solution to the above problem, i.e. Yexact (2). Box your answer.
(b) Goal is to also solve the differential equation using a Forward Euler scheme (i.e. obtain
YFE (2₂) at some discrete , locations).
i. Using uniform grid spacing Ar between discrete points, first obtain a general finite-
difference approximation (i.e. the equation is written for a general point z;, where
j can be 0,1,2,3...etc.) using the Forward Euler scheme. Box your answer.
ii. Rewriting the above equation as
Conduct linear stability analysis to identify the maximum possible step size for a
stable solution over the domain 0≤x≤ 10. Note that you will have to compare the
allowable step sizes at different a locations, and choose the most restrictive one over
-
the entire domain i.e. use different values of z between 0 and 10, and see which one
gives the most restrictive step size.
iii. Write a Matlab program to solve the differential equation over the region 0 < r ≤ 10.
Use three different step sizes Az - 0.1, 0.5, 1.0 and compare your numerical solution
YFE(T;) to the exact solution by plotting them on the same graph [i.e. For each
time-step, plot yexact versus z and ypg versus z on one plot. You will thus have three
different figures for each Ar. Clearly label your plots, clearly identify exact and
numerical solution on each plot. Use axis range of [0, 8] for the y axis and [0, 10] for
the x-axis. Note that the exact solution should be plotted at finer intervals
to obtain a smooth curve. Provide your matlab code and graphs.