Applets:Periodendauer periodischer Signale: Difference between revisions

From LNTwww
No edit summary
No edit summary
Line 1: Line 1:
{{LntExplicitLoadMathjax}}
<p>
<p>
{{BlaueBox|TEXT=
{{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)$
$$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>
</p>
Line 8: Line 9:
<html>
<html>
<head>
<head>
  <meta charset="utf-8" />
    <meta charset="utf-8" />
  <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 {
             background-color: black;
             background-color: black;
Line 30: Line 29:
         }
         }


  </style>
        table {
            border-collapse: separate;
            border-spacing: 20px 0;
        }
    </style>
</head>
</head>






<body onload="drawNow()">
<body>
<!-- Resetbutton, Checkbox und Formel -->
<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="plotBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:170px 20px 0px 0px;"></div>
    </p>
<div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:150px; margin:-760px 20px 0px 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 -->
<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() {
     // Grundeinstellungen der beiden Applets
     // Grundeinstellungen der beiden Applets
     JXG.Options.text.useMathJax = true;
     JXG.Options.text.useMathJax = true;
Line 130: Line 147:
     }, 50);
     }, 50);


};
 
//Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
 
    function isInt(n) {
        return n % 1 === 0;
    }
 
     function getT0() {
     function getT0() {
         var A, B, C, Q;
         var A, B, C, Q;
         if (b.Value() < e.Value()) {
         if (sldF1.Value() < sldF2.Value()) {
             A = b.Value();
             A = sldF1.Value();
             B = e.Value();
             B = sldF2.Value();
         } else {
         } else {
             B = b.Value();
             B = sldF1.Value();
             A = e.Value();
             A = sldF2.Value();
         }
         }
 
         // console.log('Berechne T0 mit A=' + A, 'B=' + B);
         console.log('Berechne T0 mit A=' + A, 'B=' + B);
 
         for (var x = 1; x <= 100; x++) {
         for (var x = 1; x <= 100; x++) {
             C = A / x;
             C = A / x;
             Q = B / C;
             Q = B / C;
             console.log(x + '. Durchgang: C = ' + C, 'Q = ' + Q);
             // console.log(x + '. Durchgang: C = ' + C, 'Q = ' + Q);
             if (isInt(Q)) {
             if (isInt(Q)) {
                 console.log('Q ist eine Qanzzahl!!! T0 ist damit ', 1 / C);
                 // console.log('Q ist eine Ganzzahl!!! T0 ist damit ', 1 / C);
                 return 1 / C;
                 return 1 / C;
             }
             }
Line 156: Line 174:
                 return 10;
                 return 10;
             }
             }
             if ((1/C) > 10)
             if ((1 / C) > 10)
                 return 10
                 return 10
         }
         }
     }
     }


    function isInt(n) {
        return n % 1 === 0;
    }


//Definition der Funktion zum An- und Ausschalten des Koordinatengitters
 
function showgrid() {
    // Ausgabe des Wertes x(t)
    if (gridbox.checked) {
    setInterval(function() {
      xaxis = plotBox.create('axis', [[0, 0], [1,0]], {});
        document.getElementById("x(t)").innerHTML = Math.round((sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * sldT.Value() - 2 * Math.PI * sldPHI1.Value() / 360) + sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * sldT.Value() - 2 * Math.PI * sldPHI2.Value() /
      yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {});
            360)) * 1000) / 1000;
    } else {
    }, 50);
    xaxis.removeTicks(xaxis.defaultTicks);
 
    yaxis.removeTicks(yaxis.defaultTicks);
    // Ausgabe des Wertes x(t+T_0)
    }
    setInterval(function() {
    plotBox.fullUpdate();
        document.getElementById("x(t+T_0)").innerHTML = Math.round((sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * (sldT.Value() + Math.round(getT0() * 1000) / 1000) - sldPHI1.Value()) + sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * (sldT.Value() +
};
            Math.round(getT0() * 1000) / 1000) - sldPHI2.Value())) * 1000) / 1000;
    }, 50);
 
    // Ausgabe des Wertes x(t+2T_0)
    setInterval(function() {
        document.getElementById("x(t+2T_0)").innerHTML = Math.round((sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * (sldT.Value() + 2 * Math.round(getT0() * 1000) / 1000) - sldPHI1.Value()) + sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * (sldT.Value() +
            2 * Math.round(getT0() * 1000) / 1000) - sldPHI2.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((sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * (i / 1000) - 2 * Math.PI * sldPHI1.Value() / 360) + sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * (i / 1000) - 2 * Math.PI * sldPHI2.Value() / 360)) * 1000) / 1000;
        }
        document.getElementById("x_max").innerHTML = Math.max.apply(Math, x);
    }, 50);
 
 
 
    // 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();
    };
 
    // Definition des Reset-Buttons
    function rst() {
        document.getElementById("jxgForm").reset();
    };
</script>
</script>
</body>
</body>
</html>
</html>
{{Display}}

Revision as of 09:50, 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$=