matlab tutorial 2017 - wordpress.com · § backslashlöst gleichungssysteme so optimal wie...

26
| | 01.10.17 1 Matlab Tutorial

Upload: others

Post on 07-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 1

Matlab Tutorial

Page 2: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Operationsfenster: Eingabe von Befehlen möglich

01.10.17 2

Eingabe von Befehlen

Page 3: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Workspace: Alle gespeicherten Variablen sichtbar

01.10.17 3

Workspace

Page 4: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 4

Matrizen erzeugen

Page 5: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Werte extrahieren und einfügen

01.10.17 5

Matrizen manipulieren

Page 6: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Backslash operator \

01.10.17 6

Lineare Gleichungssysteme lösen I

Page 7: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Backslash löst Gleichungssysteme so optimal wie möglich.§ Falls nicht quadratisch: Sucht x, so dass Bx – v so klein wie möglich.

01.10.17 7

Lineare Gleichungssysteme lösen II

Page 8: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Liste der Elementarfunktionen: help elfun

01.10.17 8

Elementare Funktionen

Page 9: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 9

if-Statements I

Page 10: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 10

if-Statements II

Page 11: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Verständlich, aber langsam.

01.10.17 11

for-Schleifen

Page 12: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 12

while-Schleifen

Page 13: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 13

Timing I

Page 14: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

|| 01.10.17 14

Timing II

Page 15: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ 2-dimensionale plots: 1d-Punkte vs. 1d-Werte

01.10.17 15

2D Plots I

Page 16: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Optionen des plot Befehls

01.10.17 16

2D Plots II

Page 17: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Mehrere plots in einem Fenster: subplot

01.10.17 17

2D Plots III

Page 18: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Kurven in 3D

01.10.17 18

3D Plots

Page 19: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Einen Befehlsablauf als MATLAB-Script speichern

§ Aufruf vom Kommandofenster ohne Endung§ Vereinfacht Code-Gestaltung

01.10.17 19

.m Dateien

Page 20: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Funktion: Input, Output

§ Funktionen müssen als .m-Datei abgespeichert werden§ Dateiname gleich wie Funktionsname! (Quadrat.m)§ MATLAB sucht nach Funktionen innerhalb aktuellen

Ordners

01.10.17 20

Funktionen I

Page 21: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Aufrufbar von Kommandozeile oder Script, falls Script und Funktion im gleichen Ordner

§ Call-files: Script zu einer Funktion, welches die Funktionmit Parametern aufruft

§ Variablen, die kein Output der Funktion sind gehenverloren.

01.10.17 21

Funktionen II

Page 22: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Beispiel Leibniz-Reihe§ Approximiert PI durch endliche Summe

01.10.17 22

Funktionen III

Page 23: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Call-File:

01.10.17 23

Funktionen IV

Page 24: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Fehler plotten:

01.10.17 24

Funktionen V

Page 25: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Rekursion: Aufruf desselben Programms im Programm

01.10.17 25

Rekursion I

Page 26: Matlab Tutorial 2017 - WordPress.com · § Backslashlöst Gleichungssysteme so optimal wie möglich. § Falls nicht quadratisch: Suchtx, so dassBx–v so kleinwiemöglich. 01.10.17

||

§ Gleiche Berechnung iterativ gelöst:

01.10.17 26

Rekursion II