% look at the help button, click at help window; keep that window around
% for help on specific commands or topics. That's more convenient than using
% help ... directly in the matlab command window.

% examples of regular vectors that give an empty as an answer:
3:-1:4
ans =
   Empty matrix: 1-by-0
3:2
ans =
   Empty matrix: 1-by-0

% To look at the script called up by my command
page13
% use the following:
type page13

% from page 13
n = 21; x = linspace(0,1,n); y = sin(2*pi*x);
plot(x,y)
title('The Function  y = sin(2*pi*x)')
xlabel('x (in radians)')
ylabel('y')

% to edit a matlab file, you can use the edit command; it brings up a
% separate window, for editing:

edit ExpPlot

% The editing involved vectorization of a function evaluation and resulting
% in the following cleaner version of the book's ExpPlot script from page 16:

type ExpPlot

% Script File: ExpPlot
% Examines the function
%
%      f(x) = ((1 + x/24)/(1 - x/24 + x^2/384))^8
%
% as an approximation to exp(z) across [0,1].

close all
x  = linspace(0,1,200);

 y= ((1 + x/24)./(1 - x/24 + x.^2/384)).^8;
plot(x,y,x,exp(x))

% .. and it does exactly what it was supposed to do:

ExpPlot


% QUESTION: what happens when you forget the . somewhere during vectorization:
% ANSWER: let's try it out:
x = 1:21;
x/x
ans =
    1.0000
% ... Well, matlab always tries to make some sense of your input. In this case
% it will be only much later in this course that you will understand this :-)

diary off
