Question: 6 . 1 8 In this problem, we will look at the convergence of the solution to a boundary value problem as a function of

6.18 In this problem, we will look at the convergence of the solution to a boundary
value problem as a function of the grid spacing. Consider the reaction-diffusion equation
d2cdx2=k(x)c
where the spatially dependent reaction term is
k(x)=10[1+sin(x)]
The boundary conditions for the problem are c(-1)=1 and c(1)=0.5.
You should write a MATLAB code that solves this problem using centered finite
differences for grid spacings x=12,14,dots,11024. For the smallest value of
x=xmin, make a plot of the concentration versus position. We will estimate the
error in the solution by comparing the value of the solution at x=0 for the different
values of x. Define the error of the solution as
lon(x)=c(0,x)c(0,xmin)-1
In other words, lets assume that the finest grid spacing corresponds to a "perfect" solu-
tion and assess the fractional error at the other values of x. Make a semilog-x plot of lon
versus x.
Please write code in MATLAB to solve this problem and do not use any automatic matlab functions
6 . 1 8 In this problem, we will look at the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!