function [J] = sect_4_prob_2_J_min_fn(lambda_0, t_0,t_f,x_0_ic, u0,x0,n,a,b,c) % % Written by: % -- % John L. Weatherwax 2006-08-28 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % First integate the given differential equations from t=0 to t=t_f: % sol = ode23s( @(t,x) sect_4_prob_2_J_ode_fn(t,x, u0,x0,n,a,b,c), [t_0,t_f], [lambda_0;x_0_ic] ); lambda_t = sol.y(1,:); % extract lambda(t) % Second evaluate the expression for J: % J = 0.5 * ( lambda_t(end)^2 );