Contents

Aaron Klapheck

% In class 7-Feb-2008
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 19-Feb-2008 13:35:42 

Plotting

% Plot Types:
%   Scatter Plot (no lines between data points) - used for discrete data
%   Line Plot - Equtions (y = mx + b)


% Example plot
x = [0:0.01:20];
y = exp(x);
y1 = 5*exp(x);
plot(x, y, x, y1), axis([0 5 0 exp(5)]), title('Eponent Functions'), ...
    xlabel('\beta'), ylabel('\alpha'), ...
    legend('\alpha = e^\beta', '\alpha = 5e^\beta'), ...
    text(2.5,50,'\alpha = 5e^\beta'), text(4,50,'\alpha = e^\beta')


% Plot Commands:
%   gtext('text') - use text command intead!
%   text(x,y,'text')
%   lineWidth
%   fontsize
%   \alpha - prints the alpha sign (use quotes)

Teachers example

x = 1:20;
y = x.^3 - 4;
figure(3)
plot(x, y), title('Volume vs. Time'), ...
    xlabel('time (s)'), ylabel('volume (m^3)'), grid

Generate subplots

x = [0:0.01:20];
y = exp(x);
y1 = 5*exp(x);

subplot(2, 1, 1)
plot(x, y), axis([0 5 0 exp(5)]), title('Eponent Function'), ...
    xlabel('\beta'), ylabel('\alpha'), text(4,50,'\alpha = e^\beta')

subplot(2, 1, 2)
plot(x, y1), axis([0 5 0 exp(5)]), title('Eponent Function'), ...
    xlabel('\beta'), ylabel('\alpha'), text(2.5,50,'\alpha = 5e^\beta')