Write a MATLAB program that produces a numerical solution of

Write a MATLAB program that produces a numerical solution of an ordinary differential equation. This will involve the following steps:
Discretize the domain of the ODE into n intervals of equal length
Replace differential operator(s) by finite difference operator(s)
Construct a system of linear algebraic equations that approximates the ODE
Use MATLAB to solve the system of linear algebraic equations
Use MATLAB to plot the results

The equation to be solved is:
d^2y/dx^2 = x, for 0 x 1, with boundary conditions x(0) = a and x(1)= b

Your program must allow the user to specify n, a and b. While debugging the program, use n=10, a=0, and b=1. Determine the analytic solution of the problem with these boundary conditions, and plot the computed solution and the analytic solution on the same graph. Once the program is working, proceed to the following activities:
Determine how many intervals are required in order for the computed solution to ‘look like’ the analytic solution.
Calculate and plot the maximum error of the computed solution as a function of n.
Experiment with different values for the boundary conditions. Do you always obtain a solution? If not, why not?
Prepare a report that documents your work.

Your word-processed report should include source code as an appendix. The report should be split into logically arranged sections (which may include Introduction, Method, Results, Conclusions and so forth). When appropriate, use appropriately labeled and captioned plots to present numerical data.

Solution

x = 0:.001:1;

y1 = exp(-4*x);

y2 = exp(2*x);

yIVP = (1/3)*y1 + (2/3)*y2;

yBVP = (1/(1-exp(-6)))*y1 + (1/(1-exp(6)))*y2;

plot(x,yIVP,x,yBVP),

grid on legend(’IVP soln’,’BVP soln’)

Write a MATLAB program that produces a numerical solution of an ordinary differential equation. This will involve the following steps: Discretize the domain of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site