Lecture 1 - Intro
Lecture 1 - Intro
1
Introduction
2 Programming, M. Krauledat
Schedule
Week Topic of Lecture
1 Organizational Matters, Algorithms, Matlab as a Calculator
2 Vectors and matrices
3 Graphics, File I/O
4 Data types
5 Scripts and Functions
6 Selection Statements
7 Loop Statements
8 Nested Loops
9 Recursion
10 Advanced Graphics
11 Function Handles
12 Symbolic Mathematics
13 Polynomials
14 Debugging
3
Moodle course
Programming WS 23/24
Password: h4ck1n6w523
4
Introduction to Algorithms
5
History of algorithms
That guy
6
History of algorithms
7
Simple algorithms: Experiment 1
8
9
Experiment 1
10
Experiment 1: A possible solution
11
Experiment 1: A different solution
12
Experiment 2
13
Experiment 2
31
14
Experiment 2
42
15
Experiment 2
23
16
Experiment 2
1
17
Experiment 2
87
18
Experiment 2
7
19
Experiment 2
END
20
Experiment 2
21
A possible algorithm
22
What is an algorithm?
Terminology.
Algorithm: A set of steps that defines how a task is
performed
Program: A representation of an algorithm
Programming: The process of developing a
program
Software: Programs and algorithms
Hardware: Equipment
23
What is an algorithm?
24
What is an algorithm?
25
What is an algorithm?
Example:
26
What is an algorithm?
Exercise:
Use the „checklist for algorithms“ to show that
„Counting the number of people in a room“ is really
an algorithm!
Animation
27
What is an algorithm?
Example:
28
What is an algorithm?
Exercise:
Use the „checklist for algorithms“ to show that
„Counting the audience, Version 2“ is really an
algorithm!
29
What is an algorithm?
Source: greatspaceorganizing.com
Example:
How do you find the name
of a person in a
telephone book?
Source: www.kba.com
31
What is an algorithm?
Example:
Phonebook, Version 1.
1. Read the first name.
2. As long as you didn‘t
find the correct name:
• Read the next name.
Source: www.kba.com
32
What is an algorithm?
Exercise:
Phonebook, Version 2.
1. Open the phone book
somewhere in the middle and
look for the name.
2. If the wanted name is „larger“:
throw away the lower half of the
book and start over.
3. If the wanted name is „lower“:
throw away the upper half of
the book and start over.
Source: www.kba.com
33
What is an algorithm?
34
Engineering Software
R Statistical Computing:
Free software environment for statistical
computing. Tons of available modules and
software downloads via the integrated
package manager.
http://www.r-project.org
Microsoft Excel:
Calculations with spreadsheets. Easy data
sharing with „non-engineering“ colleagues.
Industry standard on office PCs. Extended
functionalities by macro programming
(Visual Basic).
35 Programming, M. Krauledat
Engineering Software
Scilab: Free open source software for
numerical computation
www.scilab.org
36 Programming, M. Krauledat
What is MATLAB?
37 Programming, M. Krauledat
What does MATLAB offer?
• Pros:
− Easy to use: on-line documentation, manuals, workspace browser,
extensive demos
− Platform independent: runs on different operating systems
(Windows, Linux, Unix, Mac)
− Extensive library of predefined functions
− Device-independent plotting
− Allows GUI programming for simple software interaction
− Standard in industry and academia
− Standardized interfaces to other software
− Rapid prototyping: no compilation step required
38 Programming, M. Krauledat
What does MATLAB offer?
39 Programming, M. Krauledat
What is MATLAB?
• Cons:
− Computation time: interpreted language which runs
slower than compiled language, proper structure of
MATLAB program required
− High cost: 5-10 times more expensive than C or Fortran
compiler
− Software only runs on computers where MATLAB is
installed, “software roll-out” not feasible
40 Programming, M. Krauledat
Literature
http://www.mathworks.de/moler/chapters.html
http://www.mathworks.com/academia/student_center/tutorials
41 Programming, M. Krauledat
Prerequisite: Typing
Programming requires you to write code in an editor. You will have to use
a computer keyboard efficiently!
Learn to type!
Online resources:
• http://www.typingweb.com (Courses and tests, including special
characters and entire phrases)
• http://www.funtotype.com (Games for improving speed and accuracy
of typing)
42 Programming, M. Krauledat
Homework: Typing
• Go to http://funtotype.com
• Play „Keyboard Ninja“ at „Hard Level“
• Use 10 finger system on „all letters“
• Don‘t stop until you break 1000 points!
• Post your highscore on moodle!
43 Programming, M. Krauledat
Checklist
1. Enroll in a PT group
2. Get your PC Pool badge
3. Complete „Pre-Quiz 1“
4. Download and install Matlab
44 Programming, M. Krauledat