% Approximate solution to Airy BVP % y" - x*y = 0, 0 < x < infty % y(0) = 1, y(infty) = 0 % using Taylor series approximants about x0 = 0 to two ind. solns % y0(x) and y1(x) of Airy's equation truncated after term P, and % replacing infty by xlarge. % P and xlarge are parameters.specified below by user. % Because y0(0) = 1 and y1(0) = 0, form of solution is % y(x) = y0(x) + c*y1(x), where c is a constant that must be % determined to satisfy y(xlarge) = 0. xlarge = 5; Pchoices = [1 3 7 10 30]; x = (0:0.01:1)*xlarge; % Plotting points; note x(end) = xlarge for j = 1:nP P = Pchoices(j) [y0,y1] = airy_ts(x,P); c = -y0(end)/y1(end) plot(x,y0+c*y1,[color(j) '-']) % cycle through plot colors hold on legend_entry(j)= {['P=' int2str(P) ', c=' num2str(c)]}; % j'th cell of a cell array end hold off ylim([-1 2]) xlabel('x') ylabel('y^P(x)') legend(legend_entry{1:nP},'Location','SouthWest') title('Truncated Taylor Series approximants y_0(x) + cy_1(x) to Airy BVP y(0)=1,y(5)=0')