Author: Johannes Kiesel

Rechtecksimpuls

Zufallswolke

linearer

gaußscher

Sinusschwingung
             |

l(x) = 1

Weichzeichner

Pixel erzeugen (JavaScript)

Ungeglättet:

Geglättet mit linearer Filtermatrix:

Geglättet mit gaußscher Filtermatrix:

- S

-W

stdabw = 0.1 (slider from 0.1 to 0.5, step 0.1)
e = 3 (slider from 0 to 10, step 0.1)
A1 = RandomNormal(0.0, stdabw)
A2: A1 + RandomNormal[0.0, stdabw]
A3: A2 + RandomNormal[0.0, stdabw]
A4: A3 + RandomNormal[0.0, stdabw]
A5: A4 + RandomNormal[0.0, stdabw]
A6: A5 + RandomNormal[0.0, stdabw]
A7: A6 + RandomNormal[0.0, stdabw]
A8: A7 + RandomNormal[0.0, stdabw]
A9: A8 + RandomNormal[0.0, stdabw]
A10: A9 + RandomNormal[0.0, stdabw]
A11: A10 + RandomNormal[0.0, stdabw]
A12: A11 + RandomNormal[0.0, stdabw]
A13: A12 + RandomNormal[0.0, stdabw]
A14: A13 + RandomNormal[0.0, stdabw]
A15: A14 + RandomNormal[0.0, stdabw]
A16: A15 + RandomNormal[0.0, stdabw]
A17: A16 + RandomNormal[0.0, stdabw]
A18: A17 + RandomNormal[0.0, stdabw]
A19: A18 + RandomNormal[0.0, stdabw]
A20: A19 + RandomNormal[0.0, stdabw]
A21: A20 + RandomNormal[0.0, stdabw]
A22: A21 + RandomNormal[0.0, stdabw]
A23: A22 + RandomNormal[0.0, stdabw]
A24: A23 + RandomNormal[0.0, stdabw]
A25: A24 + RandomNormal[0.0, stdabw]
A26: A25 + RandomNormal[0.0, stdabw]
A27: A26 + RandomNormal[0.0, stdabw]
A28: A27 + RandomNormal[0.0, stdabw]
A29: A28 + RandomNormal[0.0, stdabw]
A30: A29 + RandomNormal[0.0, stdabw]
A31: A30 + RandomNormal[0.0, stdabw]
A32: A31 + RandomNormal[0.0, stdabw]
A33: A32 + RandomNormal[0.0, stdabw]
A34: A33 + RandomNormal[0.0, stdabw]
A35: A34 + RandomNormal[0.0, stdabw]
A36: A35 + RandomNormal[0.0, stdabw]
A37: A36 + RandomNormal[0.0, stdabw]
A38: A37 + RandomNormal[0.0, stdabw]
A39: A38 + RandomNormal[0.0, stdabw]
A40: A39 + RandomNormal[0.0, stdabw]
A41: A40 + RandomNormal[0.0, stdabw]
A42: A41 + RandomNormal[0.0, stdabw]
A43: A42 + RandomNormal[0.0, stdabw]
A44: A43 + RandomNormal[0.0, stdabw]
A45: A44 + RandomNormal[0.0, stdabw]
A46: A45 + RandomNormal[0.0, stdabw]
A47: A46 + RandomNormal[0.0, stdabw]
A48: A47 + RandomNormal[0.0, stdabw]
A49: A48 + RandomNormal[0.0, stdabw]
A50: A49 + RandomNormal[0.0, stdabw]
randvals: {A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, A33, A34, A35, A36, A37, A38, A39, A40, A41, A42, A43, A44, A45, A46, A47, A48, A49, A50}
a = -3 (slider from -10 to 0, step 0.1)
func = 0 (slider from 0 to 2, step 1)
pixelmod = If(func > 1.0, 1.0, 4.0)
pixel = 5 (slider from 5 to 50, step 1)
randpixel = Sequence((a + (k - 1.0) * (e - a) / (pixel - 1.0), Element[randvals, k]), k, 1.0, pixel)
n: pixel pixelmod
q: (e - a) / (n - 1.0)
sinpixel = Sequence((k, sin(k)), k, a, e, q)
rectpixel = Sequence((k, 2.0 Mod[k, 2.0] - 1.0), k, a, e, q)
r = 1 (slider from 1 to 10, step 1)
funcpixel = If(func > 0.0, If[func > 1.0, randpixel, sinpixel], rectpixel)
gauss(x) = exp(-1.0 x^(2.0) / (2.0 r))
gausspixel = Sequence(gauss(k), k, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 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* 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 r, r]], k, 1.0, (e - a) / q + 1.0)
rectblurgaussvals = Sequence(Element[rectgausssums, k] / If[k - r > 0.0, If[k + r ≤ (e - a) / q + 1.0, Sum[gausspixel], Sum[gausspixel, 2.0 r + 1.0 - (k + r - ((e - a) / q + 1.0))]], Sum[Sequence[Element[gausspixel, z], z, 2.0 - (k - r), 2.0 r + 1.0]]], k, 1.0, (e - a) / q + 1.0)
rectblurgausspixels = Sequence(((k - 1.0) q + a, Element[rectblurgaussvals, k]), k, 1.0, (e - a) / q + 1.0)
rectblurgauss = Sequence(Segment[Element[rectblurgausspixels, k], Element[rectblurgausspixels, k + 1.0]], k, 1.0, n - 1.0)
funcline = Sequence(Segment[Element[funcpixel, k], Element[funcpixel, k + 1.0]], k, 1.0, (e - a) / q)
B0 = 0
lin(x) = 1.0
linpixel = Sequence(lin(k), k, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.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 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 r, r]], k, 1.0, (e - a) / q + 1.0)
rectblurlinvals = Sequence(Element[rectlinsums, k] / If[k - r > 0.0, If[k + r ≤ (e - a) / q + 1.0, Sum[linpixel], Sum[linpixel, 2.0 r + 1.0 - (k + r - ((e - a) / q + 1.0))]], Sum[Sequence[Element[linpixel, z], z, 2.0 - (k - r), 2.0 r + 1.0]]], k, 1.0, (e - a) / q + 1.0)
rectblurlinpixels = Sequence(((k - 1.0) q + a, Element[rectblurlinvals, k]), k, 1.0, (e - a) / q + 1.0)
rectblurlin = Sequence(Segment[Element[rectblurlinpixels, k], Element[rectblurlinpixels, k + 1.0]], k, 1.0, n - 1.0)
Text3: "Glättungsradius r = " + r
Text4: "Pixelanzahl n = " + (pixel pixelmod)
b = false
c = false
linmatrix = Sequence(Text[If[k < 2.0 r + 2.0, If[k ≠ 1.0, "| "] + "" + (Element[linpixel, k]), "]"], (-1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.3 + (k - 1.0) / 3.0, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 2.0)], k, 1.0, 2.0 r + 2.0)
Text6: "Matrix, linear: 1/" + (Sum[linpixel]) + " ["
A = (-0.2, -1.5)
B = (0.1, -1.5)
C = (0.1, -3.2)
D = (-0.2, -3.2)
Vieleck1, a_1, b_1, c_1, d = Polygon(A, B, C, D)
gaussmatrix = Sequence(Text[If[k < 2.0 r + 2.0, If[k ≠ 1.0, "| "] + "" + (Element[gausspixel, k]), "]"], (-1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.3 + (k - 1.0) / 3.0, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 2.8)], k, 1.0, 2.0 r + 2.0)
Text7: "Matrix, gauss:  1/" + (Sum[gausspixel]) + " ["
Text8: "Standardabweichung
δ = " + stdabw + "
Verschieben um neu zu würfeln"
Text10: "g(x) = ℯ^(-x²/(2*" + r + "))"
E = (-3, -1.5)
F = (3, -1.5)
G = (3, -3.5)
H = (-3, -3.5)
Vieleck2, e_1, f, g, h = Polygon(E, F, G, H)
cc = false
funcabsvals = Sequence(abs(y(Element[funcpixel, k])), k, 1.0, pixel pixelmod)
max = Max(funcabsvals)
maxabs = If(Max[funcabsvals] > 1.0, Max[funcabsvals], 1.0)

Tool: Glättung, Funktion (command blurfunc)
[Funkt. ein, Int anf., Int ende, Int pixel, Int r, Funkt. g.matrix]
Input: f, a, e, n, r, g
Output: Liste2, Liste3, Liste4, Liste5, Liste7, Liste1, q

g(x) = 1.0
Liste3 = Sequence(g(k), k, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 r, r)
f(x) = sin(x)
q: (e - a) / (n - 1.0)
Liste2 = Sequence(f(k), k, a, e, q)
Liste4 = Sequence(Sum[Sequence[If[k + i > 0.0, If[k + i ≤ (e - a) / q + 1.0, Element[Liste2, i + k] Element[Liste3, i + r + 1.0], 0.0], 0.0], i, -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 r, r]], k, 1.0, (e - a) / q + 1.0)
Liste5 = Sequence(Element[Liste4, k] / If[k - r > 0.0, If[k + r ≤ (e - a) / q + 1.0, Sum[Liste3], Sum[Liste3, 2.0 r + 1.0 - (k + r - ((e - a) / q + 1.0))]], Sum[Sequence[Element[Liste3, z], z, 2.0 - (k - r), 2.0 r + 1.0]]], k, 1.0, (e - a) / q + 1.0)
Liste7 = Sequence(((k - 1.0) q + a, Element[Liste5, k]), k, 1.0, (e - a) / q + 1.0)
Liste1 = Sequence(Segment[Element[Liste7, k], Element[Liste7, k + 1.0]], k, 1.0, n - 1.0)