Introduction
Lecture Week 1
Course Goals
This is a programming course
Goal: To provide scientists and engineers with a
minimal core of basic computational tools
You will learn how to solve computational problems
Essential skill for students of all majors
Variables and Assignment Statements
Lecture Week 2
Course Team
Arif Zaman
Sohaib Khan
Murtaza Taj
Professor of Computer
Science and
Mathematics
PhD, Stanford, 1988
Research Interests:
Random Number
Generators,
Cryptography
Associate Professor and
Head
Drawing Circles
Lecture Week 3
To Make a Circle
plot(x, y)
plot(y) is the same as
x = 1:length(y)
plot(x, y)
1
0.8
0.6
0.4
0.2
>
>
>
>
>
>
t = 0:360;
x = cosd(t);
y = sind(t);
plot(x, y)
axis equal
axis([1 1 1 1])
0
0.2
0.4
0.6
0.8
1
1
0.5
0
0.5
>
t
s
DDKZz
,
^
^
Arithmetic Operators
+

Subtraction
Multiplication
./
Division
.^
expression
Addition
.*
> variable = expression
Power
Relational Operators
variable
<, <=
Less than, Less than or equal to
>, >=
Greater than, Greater than or equal
Motion and Conditionals (If)
Lecture Week 5
MOTION
Put shapes on the figure
Then you can
Make small changes between frames
move them
change them
recolor them.
Time can be 1/20th 1/50th of a second
For appearance of continuity
Time to compute the next fra
More Loops and Conditionals
Lecture Week 6
Simple Loop
for i = 1:3
i = 1;
block of code
block of code
i = 2;
end
block of code
The challenge in writing FOR
loops is to figure out a single
block of code, which on every
iteration will result in the desired
^
<
Arithmetic Operators
+
Addition

Subtraction
.*
Multiplication
./
Division
.^
Power
Relational
Relational Operators
<, <=
Less than, Less than or equal to
>, >=
Greater than, Greater than or equal to
=
Equal to
~=
Not equal to
Logical Operators
&
A
Design Patterns: Functions
Lecture Week 9
Design Patterns
We have learnt a number of patterns that we reuse
One way to reuse them is to look them up in our old
code, or notes, and then copy/paste them into our
new
A better way is to use Mfiles
We want t