% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- addpath('../../BookCode'); close all; clc; clear; % EPage 137 x = 0:0.1:1; y = gamma( x + 1 ); plot( x, y, '.', 'MarkerSize', 18 ); hold('on'); pp = polyfit( x, y, 5 ) xx = linspace( 0, 1, 100 ); yy = polyval( pp, xx ); plot( xx, yy, '-b' ); a0 = 1; a1 = -0.5748666; a2 = 0.9512363; a3 = -0.6998588; a4 = 0.4245549; a5 = -0.1010678; y_Abramowitz_N_Stegun = a0 + a1 * xx + a2 * xx.^2 + a3 * xx.^3 + a4 * xx.^4 + a5 * xx.^5; plot( xx, y_Abramowitz_N_Stegun, '-g' ); legend( 'data', 'fifth degree poly', 'Abramowitz/Stegun', 'location', 'best' ); %saveas( gcf, '../../WriteUp/Graphics/Chapter7/c_7_p_9_plot.eps', 'epsc' );