Example of Basic Script file

Lisa Oberbroeckling, Spring 2012

Contents

first problem

clc
x=linspace(-pi,pi);
y=sin(x);
plot(x,y)

second problem

problem 2a

A=[1 2 3;4 5 6;7 8 9];
B=[A(1,:); -4*A(1,:) + A(2,:); A(3,:)]

problem 2b

B2=[B(1,:); B(2,:); -7*B(1,:) + B(3,:)]
B =

     1     2     3
     0    -3    -6
     7     8     9


B2 =

     1     2     3
     0    -3    -6
     0    -6   -12

problem 2c

C=[B2(1,:); -1/3*B2(2,:); B2(3,:)]
C =

     1     2     3
     0     1     2
     0    -6   -12

problem 2d

x=linspace(-10,10);
y=exp(x);              % can comment after a command, too
plot(x,y)
title('Another Example')

third problem

A=[1 2 3;4 5 6;7 8 9;eye(3)]
% If I don't have a cell break above this comment, this
% text just appears as comments within the command lines,
% and not text on the webpage.
A =

     1     2     3
     4     5     6
     7     8     9
     1     0     0
     0     1     0
     0     0     1

Instead, have a cell break or a section break (no title) and then the text so that the text appears correctly on the webpage.

Next section

this section does not have a cell break. This may or may not be useful depending on how you want the output displayed on the published webpage. It works here because this is the last section and cell.

x=linspace(0.0001,10);
y=log(x);
plot(x,y)