Applets:Periodendauer periodischer Signale: Difference between revisions

From LNTwww
No edit summary
No edit summary
Line 1: Line 1:
{{LntExplicitLoadMathjax}}
<p>
{{BlaueBox|TEXT=
$x(t) = A_1\cdot cos\Big(2\pi f_1\cdot t- \frac{2\pi}{360}\cdot \phi_1\Big)+A_2\cdot cos\Big(2\pi f_2\cdot t- \frac{2\pi}{360}\cdot \phi_2\Big)$
}}
</p>
<html>
<html>
<head>
<head>
Line 4: Line 12:
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.6/jsxgraphcore.js"></script>
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.6/jsxgraphcore.js"></script>
     <!-- <script type="text/javascript" src="https://en.lntwww.de/MathJax/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig"></script> -->
     <!-- <script type="text/javascript" src="https://en.lntwww.de/MathJax/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig"></script> -->
    <!-- <script type="text/javascript" src="https://cdn.rawgit.com/mathjax/MathJax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script> -->
     <style>
     <style>
         .button {
         .button {
Line 21: Line 28:
             background-color: #939393;
             background-color: #939393;
         }
         }
         table {
         table {
             border-collapse: separate;
             border-collapse: separate;
Line 30: Line 38:




<body onload="drawNow()">
<body>
<!-- Resetbutton, Checkbox, Regler und Plots -->
<form id="jxgForm">
<p>
    <!-- Resetbutton, Checkbox, Regler und Plots -->
    <input type="checkbox" id="gridbox" onclick="showgrid();" checked> <label for="gridbox">Gitterlinien Zeigen</label>
    <p>
    <button class="button" onclick="drawNow();">Reset</button>
        <input type="checkbox" id="gridbox" onclick="showgrid();" checked> <label for="gridbox">Gitterlinien Zeigen</label>
</p>
        <button class="button" onclick="rst()">Reset</button>
<div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:100px; float:top; margin:-10px 20px 100px 0px;"></div>
    </p>
<div id="pltBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:-10px 20px 100px 0px;"></div>
    <div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:100px; float:top; margin:-10px 20px 100px 0px;"></div>
    <div id="pltBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:-10px 20px 100px 0px;"></div>
</form>


<!-- Ausgabefelder -->
<!-- Ausgabefelder -->
Line 54: Line 64:


<script type="text/javascript">
<script type="text/javascript">
     function drawNow() {
     // Grundeinstellungen der beiden Applets
        // Grundeinstellungen der beiden Applets
    JXG.Options.text.useMathJax = true;
        JXG.Options.text.useMathJax = true;
    var cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {
        cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {
        showCopyright: false, showNavigation: false, axis: false,
            showCopyright: false, showNavigation: false, axis: false,
        grid: false, zoom: { enabled: false }, pan: { enabled: false },
            grid: false, zoom: { enabled: false }, pan: { enabled: false },
        boundingbox: [-1, 2.2, 12.4, -2.2]
            boundingbox: [-1, 2.2, 12.4, -2.2]
    });
        });
    var pltBox = JXG.JSXGraph.initBoard('pltBoxHtml', {
        pltBox = JXG.JSXGraph.initBoard('pltBoxHtml', {
        showCopyright: false, axis: false,
            showCopyright: false, axis: false,
        zoom: { factorX: 1.1, factorY: 1.1, wheel: true, needshift: true, eps: 0.1 },
            zoom: { factorX: 1.1, factorY: 1.1, wheel: true, needshift: true, eps: 0.1 },
        grid: false, boundingbox: [-0.5, 2.2, 12.4, -2.2]
            grid: false, boundingbox: [-0.5, 2.2, 12.4, -2.2]
    });
        });
    cnfBox.addChild(pltBox);
        cnfBox.addChild(pltBox);
 
        // Einstellungen der Achsen
    // Einstellungen der Achsen
        xaxis = pltBox.create('axis', [[0, 0], [1, 0]], {
    xaxis = pltBox.create('axis', [[0, 0], [1, 0]], {
            name: '$\\dfrac{t}{T}$',
        name: '$\\dfrac{t}{T}$',
            withLabel: true, label: { position: 'rt', offset: [-25, -10] }
        withLabel: true, label: { position: 'rt', offset: [-25, -10] }
        });
    });
        yaxis = pltBox.create('axis', [[0, 0], [0, 1]], {
    yaxis = pltBox.create('axis', [[0, 0], [0, 1]], {
            name: '$x(t)$',
        name: '$x(t)$',
            withLabel: true, label: { position: 'rt', offset: [10, -5] }
        withLabel: true, label: { position: 'rt', offset: [10, -5] }
        });
    });
        // Erstellen der Schieberegler
 
        a = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], {
    // Erstellen der Schieberegler
            suffixlabel: '$A_1=$',
    a = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], {
            unitLabel: 'V', snapWidth: 0.01
        suffixlabel: '$A_1=$',
            }),
        unitLabel: 'V', snapWidth: 0.01
        b = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], {
            suffixlabel: '$f_1=$',
            unitLabel: 'kHz', snapWidth: 0.1
         }),
         }),
         c = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], {
    b = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], {
            suffixlabel: '$\\phi_1=$',
         suffixlabel: '$f_1=$',
            unitLabel: 'Grad', snapWidth: 5
        unitLabel: 'kHz', snapWidth: 0.1
        }),
    }),
        d = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 1] ], {
    c = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], {
            suffixlabel: '$A_2=$',
        suffixlabel: '$\\phi_1=$',
            unitLabel: 'V', snapWidth: 0.01
        unitLabel: 'Grad', snapWidth: 5
        }),
    }),
        e = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], {
    d = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 1] ], {
            suffixlabel: '$f_2=$',
        suffixlabel: '$A_2=$',
            unitLabel: 'kHz', snapWidth: 0.1
        unitLabel: 'V', snapWidth: 0.01
        }),
    }),
        g = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], {
    e = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], {
            suffixlabel: '$\\phi_2=$',
        suffixlabel: '$f_2=$',
            unitLabel: 'Grad', snapWidth: 5
        unitLabel: 'kHz', snapWidth: 0.1
        }),
    }),
        t = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], {
    g = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], {
            suffixlabel: '$t=$',
        suffixlabel: '$\\phi_2=$',
            unitLabel: 's', snapWidth: 0.2
        unitLabel: 'Grad', snapWidth: 5
        }),
    }),
        // Definition der Funktion
    t = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], {
        signaldarstellung = pltBox.create('functiongraph', [function(x) {
        suffixlabel: '$t=$',
            return (a.Value() * Math.cos(2 * Math.PI * b.Value() * x - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * x - 2 * Math.PI * g.Value() / 360))
        unitLabel: 's', snapWidth: 0.2
        }], {
    }),
            strokeColor: "red"
 
        });
    // Definition der Funktion
        // Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
    signaldarstellung = pltBox.create('functiongraph', [function(x) {
        p_T0 = pltBox.create('point', [
        return (a.Value() * Math.cos(2 * Math.PI * b.Value() * x - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * x - 2 * Math.PI * g.Value() / 360))
            function() {
    }], {
                return (Math.round(getT0() * 100) / 100);
        strokeColor: "red"
            },
    });
            function() {
 
                return a.Value() * Math.cos(2 * Math.PI * b.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * c.Value() / 360) +
    // Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
                    d.Value() * Math.cos(2 * Math.PI * e.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * g.Value() / 360);
    p_T0 = pltBox.create('point', [
            }],
        function() {
            { color: "blue", fixed: true, label: false, size: 1, name: '' }
            return (Math.round(getT0() * 100) / 100);
        );
        },
        p_T0h = pltBox.create('point',
        function() {
            [function() { return (Math.round(getT0() * 100) / 100); }, 2],
            return a.Value() * Math.cos(2 * Math.PI * b.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * c.Value() / 360) +
            { visible: false, color: "blue", fixed: true, label: false, size: 1, name: '' }
                d.Value() * Math.cos(2 * Math.PI * e.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * g.Value() / 360);
        );
        }],
        l_T0 = pltBox.create('line', [p_T0, p_T0h])
        { color: "blue", fixed: true, label: false, size: 1, name: '' }
        // Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
    );
        setInterval(function() {
    p_T0h = pltBox.create('point',
            document.getElementById("T_0").innerHTML = Math.round(getT0() * 100) / 100;
        [function() { return (Math.round(getT0() * 100) / 100); }, 2],
          }, 50);
        { visible: false, color: "blue", fixed: true, label: false, size: 1, name: '' }
        function isInt(n) {
    );
            return n % 1 === 0;
    l_T0 = pltBox.create('line', [p_T0, p_T0h])
 
    // Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
    setInterval(function() {
        document.getElementById("T_0").innerHTML = Math.round(getT0() * 100) / 100;
    }, 50);
 
 
 
    function isInt(n) {
        return n % 1 === 0;
    }
 
    function getT0() {
        var A, B, C, Q;
        if (b.Value() < e.Value()) {
            A = b.Value();
            B = e.Value();
        } else {
            B = b.Value();
            A = e.Value();
         }
         }
         function getT0() {
         // console.log('Berechne T0 mit A=' + A, 'B=' + B);
            var A, B, C, Q;
        for (var x = 1; x <= 100; x++) {
            if (b.Value() < e.Value()) {
            C = A / x;
                A = b.Value();
            Q = B / C;
                B = e.Value();
            // console.log(x + '. Durchgang: C = ' + C, 'Q = ' + Q);
             } else {
             if (isInt(Q)) {
                 B = b.Value();
                 // console.log('Q ist eine Ganzzahl!!! T0 ist damit ', 1 / C);
                 A = e.Value();
                 return 1 / C;
             }
             }
             // console.log('Berechne T0 mit A=' + A, 'B=' + B);
             if (x === 10) {
            for (var x = 1; x <= 100; x++) {
                return 10;
                C = A / x;
                Q = B / C;
                // console.log(x + '. Durchgang: C = ' + C, 'Q = ' + Q);
                if (isInt(Q)) {
                    // console.log('Q ist eine Ganzzahl!!! T0 ist damit ', 1 / C);
                    return 1 / C;
                }
                if (x === 10) {
                    return 10;
                }
                if ((1 / C) > 10)
                    return 10
             }
             }
            if ((1 / C) > 10)
                return 10
        }
    }
    // Ausgabe des Wertes x(t)
    setInterval(function() {
        document.getElementById("x(t)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * t.Value() - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * t.Value() - 2 * Math.PI * g.Value() /
            360)) * 1000) / 1000;
    }, 50);
    // Ausgabe des Wertes x(t+T_0)
    setInterval(function() {
        document.getElementById("x(t+T_0)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (t.Value() + Math.round(getT0() * 1000) / 1000) - c.Value()) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (t.Value() +
            Math.round(getT0() * 1000) / 1000) - g.Value())) * 1000) / 1000;
    }, 50);
    // Ausgabe des Wertes x(t+2T_0)
    setInterval(function() {
        document.getElementById("x(t+2T_0)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (t.Value() + 2 * Math.round(getT0() * 1000) / 1000) - c.Value()) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (t.Value() +
            2 * Math.round(getT0() * 1000) / 1000) - g.Value())) * 1000) / 1000;
    }, 50);
    // Ausgabe des Wertes x_max
    setInterval(function() {
        var x = new Array(50000);
        for (var i = 0; i < 50001; i++) {
            x[i] = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (i / 1000) - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (i / 1000) - 2 * Math.PI * g.Value() / 360)) * 1000) / 1000;
         }
         }
         // Ausgabe des Wertes x(t)
         document.getElementById("x_max").innerHTML = Math.max.apply(Math, x);
        setInterval(function() {
    }, 50);
            document.getElementById("x(t)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * t.Value() - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * t.Value() - 2 * Math.PI * g.Value() /
 
                360)) * 1000) / 1000;
 
        }, 50);
 
        // Ausgabe des Wertes x(t+T_0)
        setInterval(function() {
            document.getElementById("x(t+T_0)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (t.Value() + Math.round(getT0() * 1000) / 1000) - c.Value()) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (t.Value() +
                Math.round(getT0() * 1000) / 1000) - g.Value())) * 1000) / 1000;
        }, 50);
        // Ausgabe des Wertes x(t+2T_0)
        setInterval(function() {
            document.getElementById("x(t+2T_0)").innerHTML = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (t.Value() + 2 * Math.round(getT0() * 1000) / 1000) - c.Value()) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (t.Value() +
                2 * Math.round(getT0() * 1000) / 1000) - g.Value())) * 1000) / 1000;
        }, 50);
        // Ausgabe des Wertes x_max
        setInterval(function() {
            var x = new Array(50000);
            for (var i = 0; i < 50001; i++) {
                x[i] = Math.round((a.Value() * Math.cos(2 * Math.PI * b.Value() * (i / 1000) - 2 * Math.PI * c.Value() / 360) + d.Value() * Math.cos(2 * Math.PI * e.Value() * (i / 1000) - 2 * Math.PI * g.Value() / 360)) * 1000) / 1000;
            }
            document.getElementById("x_max").innerHTML = Math.max.apply(Math, x);
        }, 50);
    };
     // Definition der Funktion zum An- und Ausschalten des Koordinatengitters
     // Definition der Funktion zum An- und Ausschalten des Koordinatengitters
     function showgrid() {
     function showgrid() {
Line 194: Line 220:
         }
         }
         pltBox.fullUpdate();
         pltBox.fullUpdate();
    };
    // Definition des Reset-Buttons
    function rst() {
        document.getElementById("jxgForm").reset();
     };
     };
</script>
</script>
</body>
</body>
</html>
</html>
{{Display}}
{{Display}}

Revision as of 09:54, 18 September 2017

$x(t) = A_1\cdot cos\Big(2\pi f_1\cdot t- \frac{2\pi}{360}\cdot \phi_1\Big)+A_2\cdot cos\Big(2\pi f_2\cdot t- \frac{2\pi}{360}\cdot \phi_2\Big)$

$x(t)$= $x(t+ T_0)$= $x(t+2T_0)$=
$x_{\text{max}}$= $T_0$=