% % Written by: % -- % John L. Weatherwax 2007-07-01 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; close all; clear; x = linspace( -3, +3, 100 ); y = zeros(1,length(x)); inds = find(x>0 & x<1); y(inds) = 1; % the original step function: % plot( x, y, '-' ); axis( [-3, +3, -0.5, 1.5] ); title('initial step function'); saveas( gcf, '../../WriteUp/Graphics/Chapter6/chap_6_prob_27_initial_step.eps', 'psc2' ); % the flipped step function: % plot( x, fliplr(y), '-' ); axis( [-3, +3, -0.5, 1.5] ); title('flipped step function'); saveas( gcf, '../../WriteUp/Graphics/Chapter6/chap_6_prob_27_flipped_step.eps', 'psc2' ); % the flipped step shifted by a=1/2 to the right: % a = 3/4; yF = fliplr(y); xS = x+a; % shift x by a plot( xS, yF, '-' ); axis( [-3, +3, -0.5, 1.5] ); title(['flipped step function shifted right by ',num2str(a)]); saveas( gcf, '../../WriteUp/Graphics/Chapter6/chap_6_prob_27_flipped_shifted.eps', 'psc2' ); % plot the fixed exponential function on top of this: % lambda = 2; yE = lambda * exp( -lambda * xS ); inds = find( xS<0 ); yE(inds) = 0; plot( xS, yF, 'b-' ); hold on; plot( xS, yE, 'r-' ); saveas( gcf, '../../WriteUp/Graphics/Chapter6/chap_6_prob_27_flipped_shifted_w_exp.eps', 'psc2' );