Applets:Periodendauer periodischer Signale: Unterschied zwischen den Versionen

Aus LNTwww
Wechseln zu:Navigation, Suche
Zeile 1: Zeile 1:
 +
<p>
 +
{{BlaueBox|TEXT=
 +
<B style="font-size:18px">Funktion:</B>
 +
$$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>
Zeile 5: Zeile 12:
 
     <!-- <script type="text/javascript" src="https://www.lntwww.de/MathJax/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig"></script> -->
 
     <!-- <script type="text/javascript" src="https://www.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> -->
 
     <!-- <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 {
 
             background-color: black;
 
             background-color: black;
Zeile 21: Zeile 28:
 
             background-color: #939393;
 
             background-color: #939393;
 
         }
 
         }
        table {
+
  </style>
            border-collapse: separate;
 
            border-spacing: 20px 0;
 
        }
 
    </style>
 
 
</head>
 
</head>
 
 
  
 
<body onload="drawNow()">
 
<body onload="drawNow()">
<!-- Resetbutton, Checkbox, Regler und Plots -->
+
<!-- Resetbutton, Checkbox und Formel -->
 
<p>
 
<p>
     <input type="checkbox" id="gridbox" onclick="showgrid();" checked> <label for="gridbox">Gitterlinien Zeigen</label>
+
     <input type="checkbox" id="gridbox" onclick="showgrid();" checked> <label for="gridbox">Gitterlinien zeigen</label>
     <button class="button" onclick="drawNow();">Reset</button>
+
     <button class="button" onclick="drawNow()">Reset</button>
 
</p>
 
</p>
<div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:100px; float:top; margin:-10px 20px 100px 0px;"></div>
+
<div id="plotBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:170px 20px 0px 0px;"></div>
<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:150px; margin:-760px 20px 0px 0px;"></div>
 
+
<div id="outBoxHtml" class="jxgbox" style="width:600px; height:100px; margin:625px 20px 0px 0px;"></div>
<!-- Ausgabefelder -->
 
<table>
 
    <tr>
 
        <td>$x(t)$=    <span id="x(t)"></span>    </td>
 
        <td>$x(t+ T_0)$=<span id="x(t+T_0)"></span> </td>
 
        <td>$x(t+2T_0)$=<span id="x(t+2T_0)"></span></td>
 
    </tr>
 
    <tr>
 
        <td>$x_{\text{max}}$=<span id="x_max"></span></td>
 
        <td>$T_0$=          <span id="T_0"></span>  </td>
 
    </tr>
 
</table>
 
 
 
  
 
<script type="text/javascript">
 
<script type="text/javascript">
    function drawNow() {
+
function drawNow() {
        // Grundeinstellungen der beiden Applets
+
//Grundeinstellungen der beiden Applets
        JXG.Options.text.useMathJax = true;
+
JXG.Options.text.useMathJax = true;
        cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {
+
plotBox = JXG.JSXGraph.initBoard('plotBoxHtml', {showCopyright:false, axis:false, 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]});
            showCopyright: false, showNavigation: false, axis: false,
+
cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {showCopyright:false, showNavigation:false, axis:false, grid:false, zoom:{enabled:false}, pan:{enabled:false}, boundingbox: [-1, 2.2, 12.4, -2.2]});
            grid: false, zoom: { enabled: false }, pan: { enabled: false },
+
outBox = JXG.JSXGraph.initBoard('outBoxHtml', {showCopyright:false, showNavigation:false, axis: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]
+
cnfBox.addChild(plotBox);
        });
+
cnfBox.addChild(outBox);
        pltBox = JXG.JSXGraph.initBoard('pltBoxHtml', {
+
//Einstellungen der Achsen
            showCopyright: false, axis: false,
+
xaxis = plotBox.create('axis', [[0, 0], [1,0]], {name:'\\[t/T\\]', withLabel:true, label:{position:'rt', offset:[-25, 15]}});
            zoom: { factorX: 1.1, factorY: 1.1, wheel: true, needshift: true, eps: 0.1 },
+
yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {name:'\\[x(t)\\]', withLabel:true, label:{position:'rt', offset:[10, -5]}});
            grid: false, boundingbox: [-0.5, 2.2, 12.4, -2.2]
+
//Festlegen der Schieberegler
        });
+
a = cnfBox.create('slider',[[-0.7,1.5],[3,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
        cnfBox.addChild(pltBox);
+
b = cnfBox.create('slider',[[-0.7,0.5],[3,0.5],[0,1,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
        // Einstellungen der Achsen
+
c = cnfBox.create('slider',[[-0.7,-0.5],[3,-0.5],[-180,0,180]], {withLabel:false, withTicks:false, snapWidth:5}),
        xaxis = pltBox.create('axis', [[0, 0], [1, 0]], {
+
d = cnfBox.create('slider',[[6,1.5],[9.7,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
            name: '$\\dfrac{t}{T}$',
+
e = cnfBox.create('slider',[[6,0.5],[9.7,0.5],[0,2,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
            withLabel: true, label: { position: 'rt', offset: [-25, -10] }
+
g = cnfBox.create('slider',[[6,-0.5],[9.7,-0.5],[-180,90,180]], {withLabel:false, withTicks:false, snapWidth:5}),
        });
+
t = cnfBox.create('slider',[[-0.7,-1.5],[3,-1.5],[0,0,10]], {withLabel:false, withTicks:false, snapWidth:0.2}),
        yaxis = pltBox.create('axis', [[0, 0], [0, 1]], {
+
//Definition der Ausgabefelder
            name: '$x(t)$',
+
texta=cnfBox.create('text',[2.8,1.87, function()
            withLabel: true, label: { position: 'rt', offset: [10, -5] }
+
  { return '\\[A_1= '+ Math.round(a.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true, fontSize:14});
        });
+
textb=cnfBox.create('text',[2.8,0.87, function()
        // Erstellen der Schieberegler
+
  { return '\\[f_1= '+ Math.round(b.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
        a = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], {
+
textc=cnfBox.create('text',[2.8,-0.13, function()
            suffixlabel: '$A_1=$',
+
  { return '\\[\\phi_1= '+ Math.round(c.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true, fontSize:14});
            unitLabel: 'V', snapWidth: 0.01
+
textd=cnfBox.create('text',[9.5,1.67, function()
            }),
+
  { return '\\[A_2= '+ Math.round(d.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true, fontSize:14});
        b = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], {
+
texte=cnfBox.create('text',[9.5,0.67, function()
            suffixlabel: '$f_1=$',
+
  { return '\\[f_2= '+ Math.round(e.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
            unitLabel: 'kHz', snapWidth: 0.1
+
textg=cnfBox.create('text',[9.5,-0.33, function()
        }),
+
  { return '\\[\\phi_2= '+ Math.round(g.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true, fontSize:14});
        c = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], {
+
textt=cnfBox.create('text',[2.8,-1.2, function()
            suffixlabel: '$\\phi_1=$',
+
  { return '\\[t= '+ Math.round(t.Value()*100)/100 +' \\]';}], {fixed:true, visible:true, fontSize:14});
            unitLabel: 'Grad', snapWidth: 5
+
textergebnis1=outBox.create('text',[-1,1.5, function()
        }),
+
  { return '\\[x(t)= '+ 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 +' \\]';}], {fixed:true, visible:true, fontSize:14});
        d = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 1] ], {
+
textergebnis2=outBox.create('text',[1.5,1.5, function()
            suffixlabel: '$A_2=$',
+
  { return '\\[x(t+T_0)= '+ 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 +' \\]';}], {fixed:true, visible:true, fontSize:14});
            unitLabel: 'V', snapWidth: 0.01
+
textergebnis3=outBox.create('text',[5,1.5, function()
        }),
+
  { return '\\[x(t+2T_0)= '+ 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 +' \\]';}], {fixed:true, visible:true, fontSize:14});
        e = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], {
+
textergebnis4=outBox.create('text',[8.5,1.5, function()
            suffixlabel: '$f_2=$',
+
{var x = new Array(50000);
            unitLabel: 'kHz', snapWidth: 0.1
+
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;};
        }),
+
return '\\[x_{max}= '+ Math.max.apply(Math,x)+' \\]';}], {fixed:true, visible:true, fontSize:14});
        g = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], {
+
textergebnis5=outBox.create('text',[10.8,1.5, function()
            suffixlabel: '$\\phi_2=$',
+
  { return '\\[T_0= '+ Math.round(getT0() *100)/100 +' \\]';}], {fixed:true, visible:true, strokeColor:'blue', fontSize:14});
            unitLabel: 'Grad', snapWidth: 5
+
//Definition der Funktion
        }),
+
signaldarstellung = plotBox.create('functiongraph',[function(x){
        t = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], {
+
        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))
            suffixlabel: '$t=$',
+
    }], {strokeColor: "red"});
            unitLabel: 's', snapWidth: 0.2
+
//Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
        }),
+
p_T0=plotBox.create('point', [function(){ return Math.round(getT0() *100)/100;},
        // Definition der Funktion
+
      function(){ return a.Value()*Math.cos(2*Math.PI*b.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*c.Value()/360)
        signaldarstellung = pltBox.create('functiongraph', [function(x) {
+
        +d.Value()*Math.cos(2*Math.PI*e.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*g.Value()/360);}], {color:"blue", fixed:true, label:false, size:1, name:''})
            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))
+
p_T0h = plotBox.create('point', [function(){ return Math.round(getT0() *100)/100;}, 2], {visible: false, color:"blue", fixed:true, label:false, size:1, name:''})
        }], {
+
l_T0 = plotBox.create('line', [p_T0, p_T0h])
            strokeColor: "red"
+
}
        });
+
//Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
        // Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
+
    function getT0() {
        p_T0 = pltBox.create('point', [
+
        var A, B, C, Q;
            function() {
+
        if (b.Value() < e.Value()) {
                return (Math.round(getT0() * 100) / 100);
+
            A = b.Value();
            },
+
            B = e.Value();
            function() {
+
        } else {
                return a.Value() * Math.cos(2 * Math.PI * b.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * c.Value() / 360) +
+
            B = b.Value();
                    d.Value() * Math.cos(2 * Math.PI * e.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * g.Value() / 360);
+
            A = e.Value();
            }],
 
            { color: "blue", fixed: true, label: false, size: 1, name: '' }
 
        );
 
        p_T0h = pltBox.create('point',
 
            [function() { return (Math.round(getT0() * 100) / 100); }, 2],
 
            { visible: false, color: "blue", fixed: true, label: false, size: 1, name: '' }
 
        );
 
        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() {
+
         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 Qanzzahl!!! T0 ist damit ', 1 / C);
                A = e.Value();
+
                return 1 / C;
            }
 
            // console.log('Berechne T0 mit A=' + A, 'B=' + B);
 
            for (var x = 1; x <= 100; x++) {
 
                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 (x === 10) {
        // Ausgabe des Wertes x(t)
+
                 return 10;
        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;
 
 
             }
 
             }
             document.getElementById("x_max").innerHTML = Math.max.apply(Math, x);
+
             if ((1/C) > 10)
        }, 50);
+
                return 10
    };
 
    // Definition der Funktion zum An- und Ausschalten des Koordinatengitters
 
    function showgrid() {
 
        if (gridbox.checked) {
 
            xaxis = pltBox.create('axis', [ [0, 0], [1, 0] ], {});
 
            yaxis = pltBox.create('axis', [ [0, 0], [0, 1] ], {});
 
        } else {
 
            xaxis.removeTicks(xaxis.defaultTicks);
 
            yaxis.removeTicks(yaxis.defaultTicks);
 
 
         }
 
         }
         pltBox.fullUpdate();
+
    }
    };
+
    function isInt(n) {
 +
         return n % 1 === 0;
 +
    }
 +
//Definition der Funktion zum An- und Ausschalten des Koordinatengitters
 +
function showgrid() {
 +
    if (gridbox.checked) {
 +
      xaxis = plotBox.create('axis', [[0, 0], [1,0]], {});
 +
      yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {});
 +
    } else {
 +
    xaxis.removeTicks(xaxis.defaultTicks);
 +
    yaxis.removeTicks(yaxis.defaultTicks);
 +
    }
 +
    plotBox.fullUpdate();
 +
};
 
</script>
 
</script>
 
</body>
 
</body>
 
</html>
 
</html>
 +
 
{{Display}}
 
{{Display}}

Version vom 18. September 2017, 10:05 Uhr

Funktion: $$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)$$