Skip to content
Snippets Groups Projects
Commit 672cbb19 authored by Gabriel Alexander Dogadov's avatar Gabriel Alexander Dogadov
Browse files

Update 04_INT/tutorial_4_part01_lagrange.ipynb,...

Update 04_INT/tutorial_4_part01_lagrange.ipynb, 04_INT/tutorial_4_part02_lokale_interpolation.ipynb, 04_INT/tutorial_4_part05_interpolation_anwendungen.ipynb, 04_INT/tutorial_4_part01_lagrange_example.ipynb, 04_INT/tutorial_4_part03_4_hermite_splines.ipynb
parent 71458fd7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Lagrange Interpolation
%% Cell type:markdown id: tags:
## Globale Interpolation Wiederholung
Gegeben: $n$ Datenpunkte
\begin{equation}
(x_1, f_1), (x_2, f_2), \dots , (x_n, f_n)
\end{equation}
Gesucht: Interpolierendes Polynom von Grad $n-1$.
\begin{equation}
p(x)
=
a_0 + a_1 x + a_2 x^2 + \cdots + a_{n-1} x^{n-1}
\end{equation}
Ansatz: Löse   $V \vec{a} = \vec{f}$
\begin{equation}
\label{eq:int:matf}
\begin{pmatrix}
1 & x_1 & x_1^2 & \cdots & x_1^{n-1}\\
1 & x_2 & x_2^2 & \cdots & x_2^{n-1}\\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1 & x_n & x_n^2 & \cdots & x_n^{n-1}
\end{pmatrix}
\begin{pmatrix}
a_0\\
a_1\\
\vdots\\
a_k
\end{pmatrix}
=
\begin{pmatrix}
f_1\\
f_2\\
\vdots\\
f_n
\end{pmatrix}
\end{equation}
%% Cell type:markdown id: tags:
## Ein anderer Ansatz
Ein Polynom für jeden Punkt bilden und alle Polynome summieren.
\begin{equation}
p(x) = \sum_{i=1}^n l_i(x)\, f_i \,
\label{eq:lagrange_interpoly}
\end{equation}
**Lagrange Basispolynome**:
\begin{equation}
l_i(x)
=
\frac{x-x_1}{x_i-x_1}
\cdot\dots\cdot
\frac{x-x_{i-1}}{x_i-x_{i-1}}
\cdot
\frac{x-x_{i+1}}{x_i-x_{i+1}}
\cdot\dots\cdot
\frac{x-x_n}{x_i-x_n}
=
\prod_{k=1 \atop k \neq i}^n
\frac{x-x_k}{x_i - x_k}\,
\end{equation}
%% Cell type:markdown id: tags:
### Beispiele für jeweils 2, 3, 4 Basispolynome
<img src="imgs/Basispolynome.png" />
%% Cell type:markdown id: tags:
## Beispiel
Gegeben Messpunkte (x, y): (1, 1), (2, 2), (3, 2), bestimme Lagrange Interpolationspolynom.
%% Cell type:markdown id: tags:
A. Lagrange Basispolynome berechnen:
$l_i(x) = \prod_{k=1 \atop k \neq i}^n \frac{x-x_k}{x_i - x_k}$
%% Cell type:markdown id: tags:
$l_1(x) = \frac{x-x_2}{x_1-x_2} \cdot \frac{x-x_3}{x_1-x_3}$
$= \frac{x-2}{1-2} \cdot \frac{x-3}{1-3}$
$= \frac{x^2 - 5x + 6}{2}$
%% Cell type:markdown id: tags:
$l_2(x) = \frac{x-x_1}{x_2-x_1} \cdot \frac{x-x_3}{x_2-x_3}$
$= \frac{x-1}{2-1} \cdot \frac{x-3}{2-3}$
$= -x^2 + 4x -3$
%% Cell type:markdown id: tags:
$l_3(x) = \frac{x-x_1}{x_3-x_1} \cdot \frac{x-x_2}{x_3-x_2}$
$= \frac{x-1}{3-1} \cdot \frac{x-2}{3-2}$
$= \frac{x^2 - 3x + 2}{2}$
%% Cell type:markdown id: tags:
Datenpunkte: (1, 1), (2, 2), (3, 2)
B. Produkte von Basispolynomen und f-Werten bilden, dann summieren:
$p(x) = \sum_{i=1}^3 l_i(x)\, f_i$
%% Cell type:markdown id: tags:
&emsp;&emsp; $= l_1(x) \cdot f_1$ &emsp; $+$ &emsp; $l_2(x) \cdot f_2$ &emsp; $+$ &emsp; $l_3(x) \cdot f_3$
%% Cell type:markdown id: tags:
&emsp;&emsp; $= \frac{x^2 - 5x + 6}{2} \cdot 1$ &emsp; $+$ &emsp; $(-x^2 + 4x -3) \cdot 2$ &emsp; $+$ &emsp; $\frac{x^2 - 3x + 2}{2} \cdot 2$
%% Cell type:markdown id: tags:
&emsp;&emsp; $ = \frac{x^2 - 5x + 6}{2}$ &emsp; $+$ &emsp; $(-2x^2 + 8x -6)$ &emsp; $+$ &emsp; $x^2 - 3x + 2$
%% Cell type:markdown id: tags:
&emsp;&emsp; $ = -\frac{x^2}{2} + \frac{5}{2}x -1$
%% Cell type:markdown id: tags:
## Lagrange und Vandermonde
Lagrange Basispolynome $l_i(x)$ als Spaltenvektoren einer Matrix $L$:
&emsp; $\vec{a} = L \vec{f}$
Mit der Vandermonde Matrix:
&emsp; $V \vec{a} = \vec{f}$ &emsp; $\Rightarrow$ &emsp; $\vec{a} = V^{-1}\vec{f}$
&emsp; $\Rightarrow$ &emsp; $L = V^{-1}$
This diff is collapsed.
%% Cell type:markdown id: tags:
## Lokale Interpolation: Einführung
%% Cell type:markdown id: tags:
**Runges Phänomen:** Polynome mit hohem Grad neigen zum Schwingen.
Stückweise interpolieren -> Polynome von kleinem Grad aneinandersetzen.
%% Cell type:markdown id: tags:
#### Stückweise quadratische, kubische, lineare Polynominterpolation
<img src='imgs/Piecewise_Interpolation.png' />
%% Cell type:markdown id: tags:
#### Kubische Interpolationspolynome für zwei Stützstellen mit variierenden Steigungen
<img src='imgs/Kubisch.png' />
Steigungen an den Stützstellen explizit vorgeben...
%% Cell type:code id: tags:
``` python
```
Source diff could not be displayed: it is too large. Options to address this: view the blob.
%% Cell type:markdown id: tags:
# Aufgabe 4 und Anwendungsbeispiele
%% Cell type:markdown id: tags:
## Strichfigur Animation
**Idee:** Für jedes Körperglied Positionen zu festen Zeitpunkten angeben.
Wie viele solche Zustände (Frames) brauchen wir für eine Animation?
%% Cell type:markdown id: tags:
**Ziel**: Gegeben wenige Keyframes, Animation mit kontinuierlich aussehender Bewegung herstellen.
**Wie**: Kubische Spline Interpolation mit unterschiedlichen Randbedingungen.
%% Cell type:markdown id: tags:
## "Tweening"
<img src='imgs/tween1.jpeg' />
%% Cell type:markdown id: tags:
<img src='imgs/tween2.jpeg' />
Taken from *tips.clip-studio.com*
%% Cell type:markdown id: tags:
## Bayerfilter
<img src='imgs/Bayer_pattern.png' />
%% Cell type:markdown id: tags:
<img src='imgs/bayer_profile.png' />
%% Cell type:markdown id: tags:
### Demosaicing: Interpolation mit benachbarten Pixeln
<img src='imgs/bayer_array.png' />
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment