function [] = prob_3_16 % % 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. % %----- warning( 'I couldn''t find two initial conditions that gave two different solutions' ); solinit = bvpinit(linspace(0,5,10),@guess1); sol = bvp4c(@f,@bcs,solinit); figure; plot( sol.x, sol.y(1,:), '-bo' ); hold on; solinit = bvpinit(linspace(0,5,10),@guess2); sol = bvp4c(@f,@bcs,solinit); plot( sol.x, sol.y(1,:), '-go' ); grid on; function v = guess1(x) % GUESS1 - % v = [ x*(x-5); 1; pi/6 ]; function v = guess2(x) % GUESS2 - % v = [ 0.1*x*(x-5); 1; pi/6 ]; function [res] = bcs(ya,yb) % BCS - % res = [ ya(1); ya(2)-0.5; yb(1); ]; function [ ode ] = f(x,y) % F - % y(1)=y(t); y(2)=v(t); y(3)=phi(t); % g = 0.032; nu = 0.02; ode = [ tan(y(3)); -(g*sin(y(3)) + nu*(y(2)^2))/(y(2)*cos(y(3))); -g/(y(2)^2); ];