% Kartik's MATLAB code % Last modified: November 19, 2007 % We are solving the boundary value problem % in Example 1 on page 666 of Burden and Faires % y'' = 1/8*(32+2x^3-yy'), where 1<=x<=3, y(1) = 17, and y(3)=43/3 % To run this program do the following: % (1) Download the files bvpsession.m, odefun.m, and bvpfun.m into % your MATLAB directory. % (2) At the MATLAB prompt, type bvpsession. You should get a plot % of the solution y versus x. clear all; solinit = bvpinit(linspace(1,3,100),[15,15]); sol = bvp4c(@odefun,@bvpfun,solinit); plot(sol.x,sol.y(1,:)); xlabel('x'); ylabel('y'); title('plot of y versus x'); 'x values are' sol.x 'y values are' sol.y(1,:)