% % 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. % %----- close all; clc; clear; % set the constants of this problem: t_0 = 0.; t_f = 10.; gamma_0 = pi/2.; gamma_d = pi/3.; % the desired gamma v_0 = 100.; % the initial velocity h_0 = 0; % the initial height h_d = 20000; % the new desired height d_gamma = 10; % error factor for gamma(t_f) error d_h = 0.01; % factor for h(t_f) error % find the optimal value for [alpha_0,alpha_1]: % options = optimset('MaxFunEvals',1000); alphas = fminsearch( @(x) sect_3_prob_2_part_e_J_min_fn(x(1), x(2), t_0, t_f, v_0, gamma_0, h_0, gamma_d, h_d, d_gamma, d_h), [ 0., 0. ], options ); alphas % evaluate J at this value of alpha sect_3_prob_2_part_e_J_min_fn(alphas(1), alphas(2), t_0, t_f, v_0, gamma_0, h_0, gamma_d, h_d, d_gamma, d_h)