function [] = prob_3_22(T) % % 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. % %----- guess = [ 1; 0; ]; solinit = bvpinit(linspace(0,T,10),guess); sol = bvp4c(@f,@bcs,solinit); figure; plot( sol.x, sol.y(1,:), '-bo' ); hold on; grid on; tmp=deval(sol,0); fprintf( 'Theta Prime at 0 = %f\n', tmp(2) ); function [res] = bcs(ya,yb) % BCS - % res = [ ya(1); yb(1)-pi; ]; function [ ode ] = f(x,y) % F - % y(1)=theta(x);y(2)=theta'(x); ode = [ y(2); -sin(y(1)); ];