# Programming in Physics: MATLAB

## Summer Term 2018

Practical exercise (short: UE for german "Uebung") for the lecture **Programming in Physics: MATLAB (PHY.A50UF)** at the Technical University Graz. Details concerning the lecture or the UE can be found at the TUG-Online. All exercises will use the Matlab-Tutor developed by the Lecturer Ass.Prof. Kernbichler and his team.

The exercises take place at the computer room in the cellar (PHK1130) and (if necessary) in the computer room on the ground floor (PHEG004F; next to the HS P2) of Physics Institute of the Technical University Graz. There are 8 Groups due to the large amount of participating students (*: My Groups):

Group A: | Monday, 16:15 - 18:00 |

Group B: | Monday, 18:00 - 19:45 |

Group H: | Wednesday, 08:00 - 09:45 |

Group C: | Wednesday, 09:45 - 11:30 |

Group D: | Wednesday, 11:30 - 13:15 |

Group E: | Wednesday, 14:15 - 16:00 |

Group F | Wednesday, 16:00 - 17:45 |

Group G | Wednesday, 17:45 - 19:30 |

## Course Content

The course teaches the basic skills needed for scientific programming using the Software MATLAB. The main focus lies on the fundamentals of programming and applying them on physically or mathematically motivated problems.

The first half of the semster deals with learning the basics of programming and the corresponding Syntax used in Matlab. The course starts with **initializing variables** and **datatypes** using simple examples, followed by some simple calculations using **vectors and matrices** which is very usefull in Matlab.

The next main topic is about programming structures such as making decisions in programs using **if**- and **switch**-statements and different types of **loops** (for- and while-loops).

After the introduction of these general programming techniques we focus on a more Matlab-specific way of programming using **arrays** and **logical indexing** (although those structures also exist in other programming languages, they are of very high significance for efficient programming in Matlab).

In the second half of the semester all the previously learned techniques will be used and deepened by applying them to more complex problems such as **calculating series expansions**, **polynomials**, **solving linear systems of equations**, **linear and non-linear data-fitting** and some other **numerical problems** (integration, ordinary differential equations, ...).

## Exercise Mode

The first requirement for a positive grade is to submit all **mandatory** exercises via the Matlab-Tutor and to fullfill the attendance requirement. If the exercises are submitted on time, the grade is determined by **two Exams**: the first one at the **half of the semester** and a second one at the **end of the semester**.

The midterm exam is mandatory for everybody and will be a **written exam without a computer** (this may be changed) and without lecture notes. The exam is considered to be positive with 60% of the total points.

The final exam is not mandatory for everybody (see below) and consists of a **written part** without lecture notes and a **programming part** where the students have access to all the examples in the Matlab-Tutor. Again this exam is considered positive with at least 60% of the total points.

The final grade is then a combination of the midterm and the final exam. In special cases also the behaviour during the exercise clases will be taken into account.

### Advanced Exam and Projects

As already mentioned above there is a possibility to "skip" the final exam. If the result of the midterm exam is very good the students can choose to participate either in the final exam, take the **"Advanced Exam"** or to hand in a **project** which exceeds the scope of the lecture.

The **Advanced exam** consists of additional mandatory exercises (which can be done at home or during the classes) dealing with topics which are not taught in the lecture (e.g. Cell-Arrays, Classes,...) and an exam at the end of the semester covering these additional topics.

Taking a **project** is another possibility to finish this course. Therefore the student has to come up with an idea of a program he wants to develop. After consultation with the lecturer (concerning the scope and also the topic of the program) the student has to hand in the finalized project in time. To check if the work has been done on their own, there will be a talk about the project with the lecturer at the end of the semester.

## Supplemental Material

All supplemental material is only accessible for registered students via the Matlab-Tutor.

### Literature

Since it is very hard to find some really good Literature concerning programming (either general or Matlab-specific) I can only recommend the Mathworks webpage and the documents which can be found in the Matlab-Tutor "Docs"-Tab for Matlab related help.

### Bernd Riederer

**Institut für Physik**

Mozartgasse 14/II

Room 0025-02-0004

8010 Graz

**—————————————————**

SS 2018 **|** MATLAB UE

**—————————————————**

**—————————————————**

**|**MATLAB UE

**—————————————————**