function fsbvp echo off; clc; clear all; close all; %FSBVP % Boundary Layer Past a flat plate. % f''' + f*f'' = 0 % with f(0) = 0, f'(0) = 0, f'(infinity) = 1 % % The BVP is solved by imposing the boundary condition at infinity % at a finite point 'infinity'. % % See help on BVP4C, BVPINIT, @. infinity = 6 % This constant guess satisfying the boundary conditions % is good enough to get convergence when 'infinity' = 6. solinit = bvpinit(linspace(0,infinity,4),[0 0 1]) sol = bvp4c(@fsode,@fsbc,solinit) eta = sol.x f = sol.y fprintf('\n'); fprintf('Value f_prime computed using infinity = %g is %7.5f.\n',infinity,f(2,end)) figure plot(eta,f(2,:),eta(end),f(2,end),'o'); %axis([0 infinity 0 1.4]); title('Boundary Layer Past a flat plate') xlabel('\eta') ylabel('df/d\eta') hold on drawnow shg hold off % -------------------------------------------------------------------------- function dfdeta = fsode(eta,f) dfdeta = [ f(2) f(3) -f(1)*f(3) ]; % -------------------------------------------------------------------------- function res = fsbc(f0,finf) res = [f0(1) f0(2) finf(2) - 1];