Skip to main content

Vektoren und Programmieren von Schleifen

  • Chapter
  • First Online:
Angewandte Mathematik 1 mit MATLAB und Julia
  • 4591 Accesses

Zusammenfassung

Nicht alle messbaren Größen können ausschließlich mit Zahlen dargestellt werden. Vektorielle Größen, wie Kräfte und Geschwindigkeiten, sind nötig, um Bewegungen von Körpern zu modellieren. Aber auch zehn Messwerte können einfacher mit Vektoren, als mit einer Liste von 10 Variablen quantifiziert werden. Was Vektoren sind, wird in diesem Kapitel vorgestellt. Zudem wird erklärt, wie man Vektoren addiert, mit Zahlen multipliziert und Skalarprodukte bildet.

Mit Computern können repetitive Aufgaben durchgeführt werden. Man benutzt dazu Schleifen, die mit Hilfe von Vektoren indiziert werden können. Dies wird im letzten Abschnitt des Kapitels erläutert.

figure a

Mittelwert zweier Vektoren

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 37.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Literatur

  1. Boyd, S., Vandenberghe, L.: Introduction to Applied Linear Algebra, Vectors, Matrices, and Least Squares. Cambridge University Press, Cambridge (2018)

    Google Scholar 

  2. Jenni, P.: Verkehrssicherheit zweistreifiger Kreisel, Anforderungen an die Projektierung. Bachelor Thesis, Berner Fachhochschule, Burgdorf (2013)

    Google Scholar 

  3. Strang, G.: Introduction to Linear Algebra, 4. Aufl. Wellesley-Cambridge Press, Wellesley (2009)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Daniel Bättig .

Aufgaben

Aufgaben

2.1

Erstellen Sie eine EXCEL-Datenblatt mit vier Spalten: WW, XX, YY und ZZ. Füllen Sie die vier Spalten jeweils mit fünf Zahlen.

  1. (a)

    Speichern Sie das Datenblatt als ein CSV-File. Lesen Sie das File mit MATLAB oder mit Julia ein.

  2. (b)

    Berechnen Sie die Vektoren \(WW+ XX\), \(XX.^2\), YY./ZZ, \( 3*ZZ - 4YY\), \( WW.*ZZ\) und die Norm ||ZZ||.

2.2

Gegeben sind die fünf Vektoren

$$ \mathbf {a} = \begin{pmatrix} 2 \\ -1 \end{pmatrix}, \; \mathbf {b} = \begin{pmatrix} 4 \\ 6 \\ 0 \end{pmatrix}, \; \mathbf {c} = \begin{pmatrix} 3 \\ 0 \\ -5\end{pmatrix}, \; \mathbf {d} = \begin{pmatrix} -2 \\ 0\\ 3\end{pmatrix} \text { und } \mathbf {e} = \begin{pmatrix} 7 \\ 1 \end{pmatrix} $$

Berechnen Sie, falls erlaubt, \(3\cdot \mathbf {a}\), \(-5\cdot \mathbf {b}\), \(\mathbf {a}+\mathbf {b}\), \(\mathbf {a}.^{-1}\), \(2\mathbf {c}-4\mathbf {d}\), \(\mathbf {e}.^2\), \(\mathbf {b}+\mathbf {c}\), \(4\mathbf {a} - 3\mathbf {e}\), \(\mathbf {a}\,.*\,\mathbf {e}\) und \(\mathbf {a}\,./\,\mathbf {e}\)

2.3

  1. (a)

    Wie lauten die Komponenten des Vektors z, wenn Sie mit MATLAB oder mit Julia die Befehle

    figure ae

    eingeben? Kontrollieren Sie Ihr Resultat mit dem Computerresultat.

  2. (b)

    Man hat in MATLAB die Vektoren x = [26:29]’ und y = [10:-2:4]’ (bzw. in Julia x = collect(26:29) und y = collect(10:-2:4)). Was würde MATLAB oder Julia anzeigen, wenn Sie die folgenden Anweisungen eintippen:

    figure af

    Kontrollieren Sie Ihr Resultat mit MATLAB oder mit Julia.

  3. (c)

    Beschreiben Sie die Wirkung der folgenden Anweisungen. Wenn Sie MATLAB benutzen:

    figure ag

    Wenn Sie Julia benutzen:

    figure ah

2.4

Es sei mit MATLAB a = [0:14]’ und b = [1:7 8 7:-1:1]’ (bzw. mit Julia a = collect(0:14) und b = [1:7; 8 ;7:-1:1]). Welche Anzeigen bewirken die folgenden MATLAB Anweisungen? Versuchen Sie das Resultat vorauszusagen, bevor Sie etwas eintippen.

figure ai

Mit Julia lauten die entsprechenden Eingaben:

figure aj

2.5

  1. (a)

    Erzeugen Sie die folgenden Vektoren mit MATLAB oder mit Julia:

    $$ \mathbf {a} = \begin{pmatrix} 4 \\ 5 \\ 6 \\ \vdots \\ 19 \end{pmatrix}, \quad \mathbf {b} = \begin{pmatrix} 9 \\ 8 \\ 7 \\ \vdots \\ -5 \end{pmatrix}, \quad \mathbf {c} = \begin{pmatrix} 2 \\ 4 \\ 6 \\ \vdots \\ 100 \end{pmatrix} $$

    Der Tippaufwand soll möglichst klein sein (Tipp: Benutzen Sie dazu die Tab. 2.1 oder 2.2).

  2. (b)

    Erzeugen Sie die folgenden Vektoren mit MATLAB oder mit Julia:

    $$ \mathbf {x} = \begin{pmatrix}1 \\ \vdots \\ 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix}, \; \quad \mathbf {y} = \begin{pmatrix} 2 \\ 2 \\ 2 \\ \vdots \\ 2 \end{pmatrix}, \quad \mathbf {z} = \begin{pmatrix} 2,\!3 \\ 2,\!5 \\ 2,\!7 \\ \vdots \\ 4,\!1 \end{pmatrix} $$

    Dabei besteht der Vektor \(\mathbf {x}\) aus 20 Einern und 19 Nullen. Der Vektor \(\mathbf {y}\) hat 15 Zweier.

2.6

  1. (a)

    Gegeben sind die Vektoren

    figure ak

    Welche Anzeigen bewirken die folgenden Anweisungen?

    figure al
  2. (b)

    Gegeben sind die Vektoren

    figure am

    Welche Anzeigen bewirken die folgenden Anweisungen?

    figure an
  3. (c)

    Wie erzeugen Sie mit MATLAB oder mit Julia die folgenden drei Vektoren mit möglichst wenig Tippaufwand?

    $$ \mathbf {x} = \begin{pmatrix}1 \\ \vdots \\ 1 \\ 2 \\ \vdots \\ 2 \end{pmatrix}, \quad \mathbf {y} = \begin{pmatrix}120 \\ 115 \\ 110 \\ \vdots \\ 55 \\ 50 \end{pmatrix}, \quad \mathbf {z} = \begin{pmatrix} 1^2 \\ 2^2 \\ 3^2 \\ \vdots \\ 50^2 \end{pmatrix} $$

    Dabei besteht der Vektor \(\mathbf {x}\) aus 10 Einern und 30 Zweiern.

2.7

  1. (a)

    Bestimmen Sie Zahlen s und t so, dass

    $$ s \begin{pmatrix} 3\\ -1 \end{pmatrix}+t \begin{pmatrix} 4\\ 3 \end{pmatrix} = \begin{pmatrix} -6\\ -11 \end{pmatrix} $$
  2. (b)

    Stellen Sie den Vektor \(\mathbf {w}\) mit Komponenten 40 und 55 als lineare Kombination des Vektors \(\mathbf {u}\) – mit Komponenten 3 und 3 – und des Vektors \(\mathbf {v}\) – mit Komponenten 1 und 2 – dar. Wie lauten die Koeffizienten der berechneten Linearkombination?

2.8

  1. (a)

    In diesem Kapitel wurden zwei verschiedene Arten der Multiplikation von Vektoren \(\mathbf {a}\) und \(\mathbf {b}\) eingeführt. Erklären Sie sie.

  2. (b)

    Gegeben sind die Vektoren

    $$ \mathbf {a} = \begin{pmatrix} 3 \\ 4\end{pmatrix} \text { und } \mathbf {b} = \begin{pmatrix} 7 \\ -2\end{pmatrix}, $$

    Berechnen Sie \(\mathbf {a}.*\mathbf {b}\) und \(\mathbf {a}^T\cdot \mathbf {b}\). Sind die beiden Vektoren orthogonal? Bestimmen Sie die Normen der beiden Vektoren.

2.9

Bestimmen Sie alle Werte c so, dass die Vektoren

$$ \mathbf {x}=\begin{pmatrix} c \\ -2 \\ 3 \end{pmatrix} \text { und }\mathbf {y}= \begin{pmatrix} c \\ c \\ -5 \end{pmatrix} $$

orthogonal sind. Berechnen Sie anschließend die Normen von \(\mathbf {x}\) und \(\mathbf {y}\).

2.10

Gegeben ist der Vektor \(\mathbf {a}\) mit den zwei Komponenten 5 und 7. Bestimmen Sie Vektoren, die orthogonal zum Vektor \(\mathbf {a}\) sind.

2.11

  1. (a)

    Bestimmen Sie den Einheitsvektor \(\mathbf {e}\), der proportional zu Vektor \(\mathbf {b}\) mit Komponenten \(-1\), \(-2\) und 5 ist.

  2. (b)

    Berechnen Sie die Komponenten des Einheitsvektors \(\mathbf {a}\), der proportional zum Vektor \(4\mathbf {e}_1 - 3\mathbf {e}_2\) ist.

2.12

Bestimmen Sie drei paarweise orthogonale Vektoren, die nicht null sind und Größe drei haben.

2.13

  1. (a)

    Zeigen Sie, dass die Vektoren

    $$ \mathbf {u} = \begin{pmatrix} 5 \\ 3 \end{pmatrix} \quad \text { und } \quad \mathbf {v} = \begin{pmatrix} -3 \\ 5 \end{pmatrix} $$

    orthogonal sind.

  2. (b)

    Wegen (a) kann man den Vektor \(\mathbf {d}\) mit den zwei Komponenten 15 und 35 als lineare Kombination der Vektoren \(\mathbf {u}\) und \(\mathbf {v}\) schreiben: \(\mathbf {d} = x_1\cdot \mathbf {u} + x_2\cdot \mathbf {v}\). Bestimmen Sie die Koeffizienten \(x_1\) und \(x_2\) der linearen Kombination.

2.14

  1. (a)

    Zeigen Sie, dass die vier Vektoren

    $$ \mathbf {a} = \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix}, \quad \mathbf {b} = \begin{pmatrix} -1 \\ -1 \\ 1 \\ 1 \end{pmatrix}, \quad \mathbf {c} = \begin{pmatrix} -1 \\ 1 \\ -1 \\ 1 \end{pmatrix} \quad \text { und } \quad \mathbf {d} = \begin{pmatrix} -1 \\ 1 \\ 1 \\ -1 \end{pmatrix} $$

    paarweise orthogonal sind.

  2. (b)

    Wegen (a) kann man den Vektor \(\mathbf {z}\) mit den vier Komponenten 20, 10, 0 und \(-10\) als lineare Kombination der Vektoren \(\mathbf {a}\), \(\mathbf {b}\), \(\mathbf {c}\) und \(\mathbf {d}\) schreiben: \(\mathbf {z} = x_1\cdot \mathbf {a} + x_2\cdot \mathbf {b} + x_3\cdot \mathbf {c} + x_4\cdot \mathbf {d}\). Bestimmen Sie die Koeffizienten \(x_1\) bis \(x_4\) der linearen Kombination.

2.15

  1. (a)

    Programmieren Sie mit MATLAB oder mit Julia eine for-Schleife, um die Summe \(1^3 + 2^3 + 3^3 + 4^3 +\dots + 200^3\) zu berechnen.

  2. (b)

    Machen Sie das Analoge für die Summe \(2^3 + 4^3 + 6^3 + 8^3 +\dots + 200^3\).

  3. (c)

    Programmieren Sie eine for-Schleife, um die Summe \(2^3 + 5^3 + 8^3 + 11^3 +\dots + 3002^3\) zu bestimmen.

2.16

  1. (a)

    Bestimmen Sie mit MATLAB oder mit Julia und einer for-Schleife die Zahl \(a_{50}\), wenn

    $$ a_1 =1, \quad a_2 = 2\cdot a_1 +1, \quad a_3 = 2\cdot a_2 +1, \quad a_4 = 2\cdot a_3 +1, \quad \dots $$
  2. (b)

    Bestimmen Sie mit MATLAB oder mit Julia und einer while-Schleife den ersten in (a) definierten Term \(a_n\), der größer als 10 000 ist.

2.17

Programmieren Sie mit MATLAB oder mit Julia eine for-Schleife, um die folgende Summe zu berechnen:

$$ 1 + \frac{1}{3} + \frac{1}{5} + \frac{1}{7} +\dots + \frac{1}{1001} $$

2.18

Schreiben Sie die folgenden endlichen Summen in der Summennotation. Prüfen Sie, ob die Anfangs- und die Endwerte richtig gewählt sind.

$$ 1+ \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{100} \qquad 1+ 3 + 5 + 7 + \cdots + 101 \qquad 1+ x^2 + x^4 + x^6 + \cdots + x^{56} $$

2.19

Schreiben Sie die endliche Summe \(1^4 + 2^4 + \dots + 50^4\) mit der Summennotation so, dass der Summationsindex (a) mit 3 beginnt, (b) mit \(-2\) beginnt oder (c) mit 59 endet.

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer-Verlag GmbH Deutschland, ein Teil von Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Bättig, D. (2020). Vektoren und Programmieren von Schleifen. In: Angewandte Mathematik 1 mit MATLAB und Julia. Springer Vieweg, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-60952-1_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-60952-1_2

  • Published:

  • Publisher Name: Springer Vieweg, Berlin, Heidelberg

  • Print ISBN: 978-3-662-60951-4

  • Online ISBN: 978-3-662-60952-1

  • eBook Packages: Computer Science and Engineering (German Language)

Publish with us

Policies and ethics