MATLAB-Befehle: Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
(48 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
[[Kategorie:MATLAB]]
[[Kategorie:MATLAB]]
[[Datei:MATLAB-Symbol-700x394.jpg|thumb|rigth|550px|Abb. 1: MATrix LABoratory (MATLAB)]]
[[Datei:MATLAB-Symbol-700x394.jpg|thumb|rigth|450px|Abb. 1: MATrix LABoratory (MATLAB<sup>®</sup>)]]
'''Autor:''' [[Benutzer:Ulrich_Schneider| Prof. Dr.-Ing. Schneider]]
'''Autor:''' [[Benutzer:Ulrich_Schneider| Prof. Dr.-Ing. Schneider]]
Diese Seite gibt eine Übersicht über gängige MATLAB-Befehle.
<br>Diese Seite gibt eine Übersicht gebräuchlicher MATLAB<sup>®</sup>-Befehle.
<!--
== Variablen ==
== Variablen ==
-->
== Mathematische Funktionen ==
== Mathematische Funktionen ==
{| class="wikitable"
{| class="wikitable"
Zeile 26: Zeile 28:
|-
|-
| [https://www.mathworks.com/help/matlab/ref/ceil.html ceil] || rundet immer auf zur nächsten größeren ganzen Zahl  
| [https://www.mathworks.com/help/matlab/ref/ceil.html ceil] || rundet immer auf zur nächsten größeren ganzen Zahl  
|-
| [https://www.mathworks.com/help/matlab/ref/complex.html complex] || Komplexe Zahl erstellen
|-
| [https://www.mathworks.com/help/matlab/ref/real.html real] || gibt Realteil einer komplexen Zahl aus 
|-
| [https://www.mathworks.com/help/matlab/ref/imag.html imag] || gibt Imaginärteil einer komplexen Zahl aus 
|-
| [https://www.mathworks.com/help/matlab/ref/angle.html angle] || Winkel einer komplexen Zahl im Bogenmaß  berechnen
|-
| [https://www.mathworks.com/help/matlab/ref/conj.html conj] || komplex-konjugierte Zahl berechnen
|-
|}
<!--
== Matrizen und Vektoren  ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/matlab/ref/figure.html figure] || neue Figur erstellen
|-
| [https://www.mathworks.com/help/matlab/ref/plot.html plot] || Messwerte anzeigen
|-
| [https://www.mathworks.com/help/matlab/ref/xlabel.html xlabel] || X-Achse beschriften
|-
| [https://www.mathworks.com/help/matlab/ref/title.html title] || Figuren-Titel ändern
|-
| [https://www.mathworks.com/help/matlab/ref/hold.html hold] || Daten im Plot halten
|-
| [https://www.mathworks.com/help/matlab/ref/text.html text] || Textfeld erzeugen
|-
| [https://www.mathworks.com/help/matlab/ref/legend.html legend] || Legende hinzufügen
|-
| [https://www.mathworks.com/help/matlab/ref/xline.html xline] || Horizontale Linie zeichnen
|-
| [https://www.mathworks.com/help/matlab/ref/xlim.html xlim] || Anzeigebeereich einschränken
|-
|}
-->
== Grafik ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/matlab/ref/figure.html figure] || neue Figur erstellen
|-
| [https://www.mathworks.com/help/matlab/ref/plot.html plot] || Messwerte anzeigen
|-
| [https://www.mathworks.com/help/matlab/ref/xlabel.html xlabel] || X-Achse beschriften
|-
| [https://www.mathworks.com/help/matlab/ref/title.html title] || Figuren-Titel ändern
|-
| [https://de.mathworks.com/help/matlab/ref/sgtitle.html sgtitle] || Figuren-Titel über alle Subplots
|-
| [https://www.mathworks.com/help/matlab/ref/hold.html hold] || Daten im Plot halten
|-
| [https://www.mathworks.com/help/matlab/ref/text.html text] || Textfeld erzeugen
|-
| [https://www.mathworks.com/help/matlab/ref/legend.html legend] || Legende hinzufügen
|-
| [https://www.mathworks.com/help/matlab/ref/xline.html xline] || Horizontale Linie zeichnen
|-
| [https://www.mathworks.com/help/matlab/ref/xlim.html xlim] <br> [https://de.mathworks.com/help/matlab/ref/ylim.html ylim] <br> [https://de.mathworks.com/help/matlab/ref/axis.html?searchHighlight=axis&s_tid=srchtitle_axis_1 axis] || Anzeigebeereich einschränken
|-
| [https://www.mathworks.com/help/matlab/ref/mesh.html mesh] || 3-dimensionale Darstellung der Matrix z als Maschendrahtmodell
|-
| [https://www.mathworks.com/help/matlab/ref/surf.html surf] || 3-dimensionale Darstellung der Matrix z als farbige Oberfläche
|-
| [https://www.mathworks.com/help/matlab/ref/hist.html hist] || Histogramm der Häufigkeit des Auftretetens von Werten
|-
| [https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html histogram] || Histogramm der Häufigkeit des Auftretetens von Werten
|-
| [https://www.mathworks.com/help/matlab/ref/close.html close] || Grafikfenster schließen
|-
| [https://www.mathworks.com/help/matlab/ref/clf.html clf] || Inhalt des Grafikfensters löschen
|-
| [https://www.mathworks.com/help/matlab/ref/stairs.html stairs] || Daten werden als Stufen dargestellt
|-
| [https://www.mathworks.com/help/matlab/ref/stem.html stem] || Daten werden als diskrete Linien dargestellt
|-
| [https://de.mathworks.com/help/matlab/ref/bar.html bar] || Balkendiagramm
|-
| [https://de.mathworks.com/help/matlab/ref/quiver.html quiver] || Vektorpfeil in Plot einzeichnen
|-
|-
|}
|}


== Grafik ==
== Bildverarbeitung  - Grafik ==
== Bildverarbeitung  - Grafik ==
{| class="wikitable"
{| class="wikitable"
Zeile 36: Zeile 119:
|-
|-
| [https://www.mathworks.com/help/matlab/ref/colormap.html colormap] || Farbskala anzeigen und verändern
| [https://www.mathworks.com/help/matlab/ref/colormap.html colormap] || Farbskala anzeigen und verändern
|-
| [https://www.mathworks.com/help/matlab/ref/ginput.html ginput] || Koordinaten aus einem Graphen auslesen
|-
|-
| [https://www.mathworks.com/help/matlab/ref/imread.html imread] || Bilddatei einlesen
| [https://www.mathworks.com/help/matlab/ref/imread.html imread] || Bilddatei einlesen
Zeile 46: Zeile 131:
|-
|-
| [https://www.mathworks.com/help/matlab/ref/imagesc.html imagesc] || Bild mit skalierten Farben darstellen
| [https://www.mathworks.com/help/matlab/ref/imagesc.html imagesc] || Bild mit skalierten Farben darstellen
|-
| [https://www.mathworks.com/help/images/ref/imshowpair.html imshowpair] || 2 Bilder vergleichen
|-
| [https://de.mathworks.com/help/images/ref/graythresh.html graythresh] || Automatische Schwellwertbestimmung
|-
| [https://de.mathworks.com/help/images/ref/im2bw.html?s_tid=doc_ta im2bw] <br> [https://de.mathworks.com/help/images/ref/imbinarize.html imbinarize]|| Binärbild erzeugen
|-
| [https://de.mathworks.com/help/matlab/ref/im2gray.html?s_tid=doc_ta im2gray] <br> [https://de.mathworks.com/help/matlab/ref/rgb2gray.html?s_tid=doc_ta rgb2gray] || Grauwertbild erzeugen
|-
| [https://de.mathworks.com/help/images/ref/imcomplement.html?s_tid=doc_ta imcomplement] || Komplementärbild erzeugen
|-
| [https://de.mathworks.com/help/matlab/ref/double.cat.html?s_tid=doc_ta cat] || Verkettung von Arrays
|-
|-
|}
|}


== Bildverarbeitung  - Fourier-Transformation ==
== Bildverarbeitung  - Bildtransformationen ==
{| class="wikitable"
{| class="wikitable"
|-
|-
Zeile 58: Zeile 155:
| [https://www.mathworks.com/help/matlab/ref/ifft2.html ifft2] || Inverse Fast Fourier Transform
| [https://www.mathworks.com/help/matlab/ref/ifft2.html ifft2] || Inverse Fast Fourier Transform
|-
|-
| [https://www.mathworks.com/help/matlab/ref/fftshift.html fftshift] || Die niedrigen Frequenzen werden ins Zentrum des Spektrums verschoben.
| [https://www.mathworks.com/help/matlab/ref/fftshift.html fftshift] || Die niedrigen Frequenzen werden ins Zentrum des Spektrums verschoben
|-
| [https://www.mathworks.com/help/matlab/ref/ifftshift.html ifftshift] || Inverse Shift Operation
|-
| [https://www.mathworks.com/help/matlab/ref/conv2.html conv2] || 2-D Konvolution
|-
| [https://www.mathworks.com/help/matlab/ref/deconvwnr.html deconvwnr] || Heuristisches Wiener Filter
|-
| [https://www.mathworks.com/help/images/ref/medfilt2.html medfilt2] || Median Filter
|-
| [https://www.mathworks.com/help/images/hough-transform.html hough] || Hough Transformation
|-
| [https://www.mathworks.com/help/images/ref/houghpeaks.html houghpeaks] || Akkumulatoren der Hough Transformation
|-
| [https://www.mathworks.com/help/images/ref/houghlines.html houghlines] || Liniensegmente mittels Hough Transformation
|-
| [https://de.mathworks.com/help/images/ref/fspecial.html fspecial] || 2D-Filterkern/Point-Spread-Function erzeugen
|-
| [https://de.mathworks.com/help/images/ref/imfilter.html imfilter] || Filterung/Anwendung einer Point-Spread-Function
|-
|}
 
== Bildverarbeitung  - Objektanalyse ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/images/edge-detection.html edge] || Kantenerkennung
|-
| [https://www.mathworks.com/help/matlab/ref/imfindcircles.html imfindcircles] || Hough Transformation für Kreise
|-
| [https://www.mathworks.com/help/matlab/ref/viscircles.html viscircles] || Kreise zeichnen
|-
| [https://www.mathworks.com/help/matlab/ref/bwboundaries.html bwboundaries] || Ränder in Binärbildern erkennen
|-
| [https://www.mathworks.com/help/matlab/ref/bwtraceboundary.html bwtraceboundary] || Ränder in Binärbildern verfolgen
|-
| [https://www.mathworks.com/help/images/ref/visboundaries.html visboundaries] || Regionsrenzen darstellen
|-
| [https://de.mathworks.com/help/images/ref/regionprops.html?s_tid=doc_ta#d123e243268 regionprops] || Eigenschaften von Regionen abfragen
|-
|-
|}
|}


== Morphologische Operationen ==
== Morphologische Operationen ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/images/ref/imerode.html imerode] || erodieren
|-
| [https://www.mathworks.com/help/images/ref/imdilate.html imdilate] || dilatieren
|-
| [https://www.mathworks.com/help/images/ref/strel.html strel] || Strukturelement erstellen
|-
| [https://www.mathworks.com/help/images/ref/imopen.html imopen] || öffnen
|-
| [https://www.mathworks.com/help/images/ref/imclose.html imclose] || schließen
|-
| [https://www.mathworks.com/help/images/ref/bwskel.html bwskel] || skeletieren
|-
| [https://www.mathworks.com/help/images/ref/bwperim.html bwperim] || Umrandung
|-
| [https://www.mathworks.com/help/images/ref/bwhitmiss.html bwhitmiss]|| Hit or Miss Operation
|-
| [https://www.mathworks.com/help/images/ref/imtophat.html imtophat] || Top-Hat Transformation
|-
| [https://www.mathworks.com/help/images/ref/imbothat.html imbothat] || Bottom-Hat Transformation
|-
| [https://www.mathworks.com/help/images/ref/imclearborder.html imclearborder] || Strukturen am Rand unterdrücken
|-
| [https://www.mathworks.com/help/images/ref/imfill.html imfill] || Regionen und Löcher füllen
|-
| [https://www.mathworks.com/help/images/ref/bwmorph.html bwmorph] || Morphologische Operationen auf Binärbilder ausführen
|-
|}
== Statistik ==
== Statistik ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://de.mathworks.com/help/matlab/ref/min.html?s_tid=doc_ta min] || Minimum
|-
| [https://de.mathworks.com/help/matlab/ref/max.html?s_tid=doc_ta max] || Maximum
|-
| [https://de.mathworks.com/help/matlab/ref/mean.html mean] || Durchschnitt
|-
| [https://de.mathworks.com/help/matlab/ref/median.html median] || Median
|-
| [https://de.mathworks.com/help/matlab/ref/std.html std] || Standardabweichung
|-
| [https://de.mathworks.com/help/matlab/ref/var.html?s_tid=doc_ta var] || Varianz
|-
|}
== Regression ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/matlab/ref/polyfit.html polyfit] || Polynomische Regression
|-
| [https://www.mathworks.com/help/matlab/ref/polyval.html polyval] || Polynom berechnen
|-
|}
== Zeitmessung ==
== Zeitmessung ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://www.mathworks.com/help/matlab/ref/tic.html tic] || Stopuhr starten
|-
| [https://www.mathworks.com/help/matlab/ref/toc.html toc] || Stopuhr auslesen
|-
|}
== Dateiverarbeitung ==
{| class="wikitable"
|-
! Befehl !! Beschreibung
|-
| [https://de.mathworks.com/help/matlab/ref/addpath.html?searchHighlight=addpath&s_tid=srchtitle_addpath_1 addpath] || Dateipfad zum Suchpfad hinzufügen
|-
| [https://de.mathworks.com/help/matlab/ref/rmpath.html rmpath] || Dateipfad aus Suchpfad entfernen
|-
| [https://de.mathworks.com/help/matlab/ref/uigetdir.html?s_tid=doc_ta uigetdir] || Ordner über Dialog-Box einlesen
|-
| [https://de.mathworks.com/help/matlab/ref/uigetfile.html uigetfile] || Dateiname/-pfad über Dialog-Box einlesen
|-
| [https://de.mathworks.com/help/matlab/ref/load.html load] || Variablen aus Datei in Workspace laden
|-
| [https://de.mathworks.com/help/matlab/ref/save.html?searchHighlight=save&s_tid=srchtitle_save_1 save] || Variablen aus Workspace in Datei speichern
|-
| [https://de.mathworks.com/help/matlab/ref/fopen.html fopen] || Datei öffnen
|-
| [https://de.mathworks.com/help/matlab/ref/fclose.html fclose] || Datei schließen
|-
| [https://de.mathworks.com/help/matlab/ref/feof.html feof] || Test auf Dateiende
|-
| [https://de.mathworks.com/help/matlab/ref/fgetl.html?s_tid=doc_ta fgetl] || Zeile aus Datei auslesen
|-
|}
== Weiterführende Links ==
* [https://www.studocu.com/de/document/universitat-duisburg-essen/informatik/matlab-befehle-zusammenfassung-informatik/2959996 MATLAB<sup>®</sup> Befehle - Zusammenfassung Informatik]
* [https://www.mathworks.com/content/dam/mathworks/fact-sheet/matlab-basic-functions-reference.pdf MATLAB<sup>®</sup> Basic Functions Reference]

Aktuelle Version vom 23. Dezember 2022, 17:26 Uhr

Abb. 1: MATrix LABoratory (MATLAB®)

Autor: Prof. Dr.-Ing. Schneider
Diese Seite gibt eine Übersicht gebräuchlicher MATLAB®-Befehle.

Mathematische Funktionen

Befehl Beschreibung
abs Absolutbetrag berechnen
exp berechnen
log log zur Basis e berechnen
log10 log zur Basis 10 berechnen
sign Vorzeichen berechnen
sqrt Quadratwurzel berechnen
round rundet ab/auf zur nächst kleineren/größeren ganzen Zahl
floor rundet immer ab zur nächsten kleineren ganzen Zahl
ceil rundet immer auf zur nächsten größeren ganzen Zahl
complex Komplexe Zahl erstellen
real gibt Realteil einer komplexen Zahl aus
imag gibt Imaginärteil einer komplexen Zahl aus
angle Winkel einer komplexen Zahl im Bogenmaß berechnen
conj komplex-konjugierte Zahl berechnen

Grafik

Befehl Beschreibung
figure neue Figur erstellen
plot Messwerte anzeigen
xlabel X-Achse beschriften
title Figuren-Titel ändern
sgtitle Figuren-Titel über alle Subplots
hold Daten im Plot halten
text Textfeld erzeugen
legend Legende hinzufügen
xline Horizontale Linie zeichnen
xlim
ylim
axis
Anzeigebeereich einschränken
mesh 3-dimensionale Darstellung der Matrix z als Maschendrahtmodell
surf 3-dimensionale Darstellung der Matrix z als farbige Oberfläche
hist Histogramm der Häufigkeit des Auftretetens von Werten
histogram Histogramm der Häufigkeit des Auftretetens von Werten
close Grafikfenster schließen
clf Inhalt des Grafikfensters löschen
stairs Daten werden als Stufen dargestellt
stem Daten werden als diskrete Linien dargestellt
bar Balkendiagramm
quiver Vektorpfeil in Plot einzeichnen

Bildverarbeitung - Grafik

Befehl Beschreibung
colormap Farbskala anzeigen und verändern
ginput Koordinaten aus einem Graphen auslesen
imread Bilddatei einlesen
imwrite Bilddatei auf Festplatte schreiben
image Bild aus einem Array darstellen
imshow Bild darstellen
imagesc Bild mit skalierten Farben darstellen
imshowpair 2 Bilder vergleichen
graythresh Automatische Schwellwertbestimmung
im2bw
imbinarize
Binärbild erzeugen
im2gray
rgb2gray
Grauwertbild erzeugen
imcomplement Komplementärbild erzeugen
cat Verkettung von Arrays

Bildverarbeitung - Bildtransformationen

Befehl Beschreibung
fft2 2-D Fast Fourier Transform
ifft2 Inverse Fast Fourier Transform
fftshift Die niedrigen Frequenzen werden ins Zentrum des Spektrums verschoben
ifftshift Inverse Shift Operation
conv2 2-D Konvolution
deconvwnr Heuristisches Wiener Filter
medfilt2 Median Filter
hough Hough Transformation
houghpeaks Akkumulatoren der Hough Transformation
houghlines Liniensegmente mittels Hough Transformation
fspecial 2D-Filterkern/Point-Spread-Function erzeugen
imfilter Filterung/Anwendung einer Point-Spread-Function

Bildverarbeitung - Objektanalyse

Befehl Beschreibung
edge Kantenerkennung
imfindcircles Hough Transformation für Kreise
viscircles Kreise zeichnen
bwboundaries Ränder in Binärbildern erkennen
bwtraceboundary Ränder in Binärbildern verfolgen
visboundaries Regionsrenzen darstellen
regionprops Eigenschaften von Regionen abfragen

Morphologische Operationen

Befehl Beschreibung
imerode erodieren
imdilate dilatieren
strel Strukturelement erstellen
imopen öffnen
imclose schließen
bwskel skeletieren
bwperim Umrandung
bwhitmiss Hit or Miss Operation
imtophat Top-Hat Transformation
imbothat Bottom-Hat Transformation
imclearborder Strukturen am Rand unterdrücken
imfill Regionen und Löcher füllen
bwmorph Morphologische Operationen auf Binärbilder ausführen

Statistik

Befehl Beschreibung
min Minimum
max Maximum
mean Durchschnitt
median Median
std Standardabweichung
var Varianz

Regression

Befehl Beschreibung
polyfit Polynomische Regression
polyval Polynom berechnen

Zeitmessung

Befehl Beschreibung
tic Stopuhr starten
toc Stopuhr auslesen

Dateiverarbeitung

Befehl Beschreibung
addpath Dateipfad zum Suchpfad hinzufügen
rmpath Dateipfad aus Suchpfad entfernen
uigetdir Ordner über Dialog-Box einlesen
uigetfile Dateiname/-pfad über Dialog-Box einlesen
load Variablen aus Datei in Workspace laden
save Variablen aus Workspace in Datei speichern
fopen Datei öffnen
fclose Datei schließen
feof Test auf Dateiende
fgetl Zeile aus Datei auslesen

Weiterführende Links