%% Chapter 3 M-File: Interacting with Matlab
clear all
close all

%% Command History Window
x = [0.1, 0.01, 0.001];
y = sin(x)/x
format long
y = sin(x)./x

%% Script M-Files
task1

%% Function M-Files
help sinelimit
sinelimit(5)
sinelimit(10)

%% Loops
f = 1;
for n = 2:10
    f = f*n;
end
f

%% Diary Files
task2

%% Graphics
x = 2*pi*(0:0.01:1);   % define the x values
figure; hold on   % open a new figure window with overlay

% Run a loop to plot the three sine curves:
for c = 1:3
    plot(x, sin(c*x))
end

hold off, axis([0, 2*pi, -1, 1])   % adjust the x-axis
title('Several Sine Curves')   % title the figure
print -deps mfiles1.eps