function [] = prob_3_17 % % Written by: % -- % John L. Weatherwax 2005-04-13 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- Pe = 1; R = 2; n = 2; guess = [ 0.5; 0 ]; solinit = bvpinit(linspace(0,1,10),guess); sol = bvp4c(@f,@bcs,solinit,[],Pe,R,n); disp( 'Solution values of interest' ); deval( sol, [ 0, 1 ] ) figure; plot( sol.x, sol.y(1,:), '-bo' ); hold on; grid on; function [res] = bcs(ya,yb,Pe,R,n) % BCS - % res = [ ya(2)-Pe*(ya(1)-1); yb(2); ]; function [ ode ] = f(x,y,Pe,R,n) % F - % y(1)=y(t); y(2)=y'(t); % ode = [ y(2); Pe*(y(2)+R*(y(1)^n)); ];