% Bruce Mayer, PE

% MTH-16 • 22Feb14

% Area_Between_fcn_Graph_BlueGreen_BkGnd_Template_1306.m

% Ref: E. B. Magrab, S. Azarm, B. Balachandran, J. H. Duncan, K. E.

% Herhold, G. C. Gregory, "An Engineer's Guide to MATLAB", ISBN

% 978-0-13-199110-1, Pearson Higher Ed, 2011, pp294-295

%

clc; clear; clf; % Clear Figure Window

%

% The Function

xmin = -2; xmax = 2;

ymin = 0; ymax = 10;

x = linspace(xmin,xmax,500);

y1 = -x.^2 + 9;

y2 = x.^2 + 1;

%

plot(x,y1,'--', x,y2,'m','LineWidth', 5), axis([0 xmaxyminymax]),...

grid, xlabel('\fontsize{14}x'), ylabel('\fontsize{14}y = f(x) = -x^2 + 9 & x^2 + 1'),...

title(['\fontsize{16}MTH16 • Bruce Mayer, PE',]),...

legend('-x^2 + 9','x^2 + 1') %

display('Showing 2Fcn Plot; hit ANY KEY to Continue')

% "hold" = Retain current graph when adding new graphs

hold on

disp('Hit ANY KEY to show Fill')

pause

%

xn = linspace(xmin, xmax, 500);

fill([xn,fliplr(xn)],[-xn.^2 + 9, fliplr(x.^2 + 1)],[.49 1 .63]), grid on

% alternate RGB triple: [.78 .4 .01]

### MATLAB code