function [] = prob_3_18 % % 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. % %----- L = 10; PoverR = 0.001; guess = [ 1; 0; 1/sqrt(2); 1/sqrt(2) ]; solinit = bvpinit(linspace(0,L,10),guess); sol = bvp4c(@f,@bcs,solinit,[],PoverR); figure; %plot( sol.y(3,:), sol.y(4,:), '-bo' ); hold on; grid on; xint = linspace(0,L); Sxint = deval(sol,xint); plot( Sxint(3,:), Sxint(4,:), '-bo' ); hold on; grid on; function [res] = bcs(ya,yb,PoverR) % BCS - % res = [ ya(1); yb(2); ya(3); ya(4)-1; ]; function [ ode ] = f(x,y,PoverR) % F - % y(1)=phi(t); y(2)=phi'(t); y(3)=x(t); y(4)=y(t) % ode = [ y(2); -(PoverR)*cos(y(1)); +cos(y(1)); -sin(y(1)); ];