% % 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.; v_0 = 100.; % the initial conditions gamma_0 = pi/2.; h_0 = 0; v_d = 5000; % the target goals gamma_d = pi/3.; h_d = 20000; q_v = 0.1; q_gamma = 10; % the error weighting factor for gamma(t_f) missing gamma_d q_h = 0.01; r_1 = 1; % the error coefficient for the integral of alpha(t) r_2 = 1; % find the optimal value for [alpha,T]: % alphas = fminsearch( @(x) sect_3_prob_4_J_min_fn(x(1), x(2), t_0, t_f, v_0, gamma_0, h_0, v_d, gamma_d, h_d, q_v, q_gamma, q_h, r_1, r_2), [ 0., 0. ] ); alphas % evaluate J at this value of alpha sect_3_prob_4_J_min_fn(alphas(1), alphas(2), t_0, t_f, v_0, gamma_0, h_0, v_d, gamma_d, h_d, q_v, q_gamma, q_h, r_1, r_2)