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>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.6/jsxgraphcore.js"></script>
+
    <meta charset="utf-8" />
</script>
+
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.6/jsxgraphcore.js"></script>
  <style>
+
    <!-- <script type="text/javascript" src="https://www.lntwww.de/MathJax/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full,local/mwMathJaxConfig"></script> -->
  .button1{
+
    <!-- <script type="text/javascript" src="https://cdn.rawgit.com/mathjax/MathJax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script> -->
    background-color: black;
+
<style>
    border: none;
+
        .button {
    color: white;
+
            background-color: black;
    font-family: arial;
+
            border: none;
    padding: 8px 20px;
+
            color: white;
    text-align: center;
+
            font-family: arial;
    text-decoration: none;
+
            padding: 8px 20px;
    display: inline-block;
+
            text-align: center;
    font-size: 16px;
+
            text-decoration: none;
    border-radius: 15px;
+
            display: inline-block;
    position:relative;
+
            font-size: 16px;
    top: 205px;
+
            border-radius: 15px;
    left: 530px;
+
        }
  }
+
        .button:active {
 
+
            background-color: #939393;
  .button1:active {
+
         }
    background-color: #939393;}
 
 
 
    .formel {
 
         background-color: #f5f5f5;
 
        border-radius: 4px ;
 
        padding: 20px 30px;
 
        font-family: arial;
 
        position:absolute;
 
        top: 250px;
 
        left: 10px;
 
    }
 
 
 
 
   </style>
 
   </style>
 
</head>
 
</head>
<body>
 
 
<form id="myForm">
 
  
 +
<body onload="drawNow()">
 
<!-- Resetbutton, Checkbox und Formel -->
 
<!-- Resetbutton, Checkbox und Formel -->
<button class="button1" style="font-size:0.750em" onclick="zurueck()">Reset</button>
+
<p>
<p><span class="separate" style="position:absolute; top:180px; left:550px; font-family:arial; font-size:0.750em;">mit Gitter<input name="gridbox" id="gridbox" type="checkbox" onclick="showgrid();" checked="checked"></span></p>
+
    <input type="checkbox" id="gridbox" onclick="showgrid();" checked> <label for="gridbox">Gitterlinien Zeigen</label>
<box class="formel">\(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)\)</box>
+
    <button class="button" onclick="drawNow();">Reset</button>
 +
</p>
 +
<div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:150px; float:top; margin:-10px 20px 100px 0px;"></div>
 +
<div id="pltBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:-100px 20px 10px 0px;"></div>
  
<div id="box1" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:300px 20px 100px 0px;"></div>
+
<!-- Ausgabefelder -->
<div id="box2" class="jxgbox" style="width:500px; height:200px; border:1px solid white; margin:-1000px 20px 100px 0px;"></div>
 
<div id="box3" class="jxgbox" style="width:600px; height:100px; border:1px solid white; margin:700px 20px 100px 0px;"></div>
 
  
<script type="text/javascript">
+
<table>
 +
    <tr>
 +
        <td>$x(t)$= <span id="x(t)"></span>  $\quad$ </td>
 +
        <td>$x(t+ T_0)$= <span id="x(t+T_0)"></span>  $\quad$ </td>
 +
        <td>$x(t+2T_0)$= <span id="x(t+2T_0)"></span>  $\quad$ </td>
 +
        <td>$x_{\text{max}}$= <span id="x_max"></span>  $\quad$ </td>
 +
        <td style="color:blue;">$T_0$= <span id="T_0"></span>  $\quad$ </td>
 +
    </tr>
 +
</table>
  
//Grundeinstellungen der beiden Applets
 
JXG.Options.text.useMathJax = true;
 
var brd1 = JXG.JSXGraph.initBoard('box1', {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]});
 
var brd2 = JXG.JSXGraph.initBoard('box2', {showCopyright:false, showNavigation:false, axis:false, grid:false, zoom:{enabled:false}, pan:{enabled:false}, boundingbox: [-1, 2.2, 12.4, -2.2]});
 
var brd3 = JXG.JSXGraph.initBoard('box3', {showCopyright:false, showNavigation:false, axis:false, grid:false, zoom:{enabled:false}, pan:{enabled:false}, boundingbox: [-1, 2.2, 12.4, -2.2]});
 
brd2.addChild(brd1);
 
brd2.addChild(brd3);
 
  
//Einstellungen der Achsen
+
<script type="text/javascript">
xaxis = brd1.create('axis', [[0, 0], [1,0]], {name:'\\[t/T\\]', withLabel:true, label:{position:'rt', offset:[-25, 15]}});
+
function drawNow() {
yaxis = brd1.create('axis', [[0, 0], [0, 1]], {name:'\\[x(t)\\]', withLabel:true, label:{position:'rt', offset:[10, -5]}});
+
        // Grundeinstellungen der beiden Applets
 
+
        JXG.Options.text.useMathJax = true;
//Festlegen der Schieberegler
+
        cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {
a = brd2.create('slider',[[-0.7,1.5],[3,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
+
            showCopyright: false, showNavigation: false, axis: false,
b = brd2.create('slider',[[-0.7,0.5],[3,0.5],[0,1,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
+
            grid: false, zoom: { enabled: false }, pan: { enabled: false },
c = brd2.create('slider',[[-0.7,-0.5],[3,-0.5],[-180,0,180]], {withLabel:false, withTicks:false, snapWidth:5}),
+
            boundingbox: [-1, 2.2, 12.4, -2.2]
d = brd2.create('slider',[[6,1.5],[9.7,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
+
        });
e = brd2.create('slider',[[6,0.5],[9.7,0.5],[0,2,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
+
        pltBox = JXG.JSXGraph.initBoard('pltBoxHtml', {
g = brd2.create('slider',[[6,-0.5],[9.7,-0.5],[-180,90,180]], {withLabel:false, withTicks:false, snapWidth:5}),
+
            showCopyright: false, axis: false,
t = brd2.create('slider',[[-0.7,-1.5],[3,-1.5],[0,0,10]], {withLabel:false, withTicks:false, snapWidth:0.2}),
+
            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]
 
+
        });
//Definition der Ausgabefelder
+
        cnfBox.addChild(pltBox);
texta=brd2.create('text',[3.2,1.7, function()
+
        // Einstellungen der Achsen
  { return '\\[A_1= '+ Math.round(a.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true});
+
        xaxis = pltBox.create('axis', [[0, 0], [1, 0]], {
textb=brd2.create('text',[3.2,0.7, function()
+
            name: '$\\dfrac{t}{T}$',
  { return '\\[f_1= '+ Math.round(b.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true});
+
            withLabel: true, label: { position: 'rt', offset: [-25, -10] }
textc=brd2.create('text',[3.2,-0.3, function()
+
        });
  { return '\\[\\phi_1= '+ Math.round(c.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true});
+
        yaxis = pltBox.create('axis', [[0, 0], [0, 1]], {
textd=brd2.create('text',[9.9,1.57, function()
+
            name: '$x(t)$',
  { return '\\[A_2= '+ Math.round(d.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true});
+
            withLabel: true, label: { position: 'rt', offset: [10, -5] }
texte=brd2.create('text',[9.9,0.57, function()
+
        });
  { return '\\[f_2= '+ Math.round(e.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true});
+
        // Erstellen der Schieberegler
textg=brd2.create('text',[9.9,-0.43, function()
+
        sldA1 = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], {
  { return '\\[\\phi_2= '+ Math.round(g.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true});
+
            suffixlabel: '$A_1=$',
textt=brd2.create('text',[3.2,-1.3, function()
+
            unitLabel: 'V', snapWidth: 0.01
  { return '\\[t= '+ Math.round(t.Value()*100)/100 +' \\]';}], {fixed:true, visible:true});
+
            }),
 
+
        sldF1 = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], {
textergebnis1=brd3.create('text',[-0.5,1.5, function()
+
            suffixlabel: '$f_1=$',
  { 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});
+
            unitLabel: 'kHz', snapWidth: 0.1
textergebnis2=brd3.create('text',[1.6,1.5, function()
+
        }),
  { 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});
+
        sldPHI1 = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], {
textergebnis3=brd3.create('text',[4.5,1.5, function()
+
            suffixlabel: '$\\phi_1=$',
  { 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});
+
            unitLabel: 'Grad', snapWidth: 5
textergebnis4=brd3.create('text',[7.75,1.5, function()
+
        }),
{var x = new Array(50000);
+
        sldA2 = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 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;};
+
            suffixlabel: '$A_2=$',
return '\\[x_{max}= '+ Math.max.apply(Math,x)+' \\]';}], {fixed:true, visible:true});
+
            unitLabel: 'V', snapWidth: 0.01
textergebnis5=brd3.create('text',[10.5,1.5, function()
+
        }),
  { return '\\[T_0= '+ Math.round(getT0() *100)/100 +' \\]';}], {fixed:true, visible:true, strokeColor:'blue'});
+
        sldF2 = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], {
 
+
            suffixlabel: '$f_2=$',
 
+
            unitLabel: 'kHz', snapWidth: 0.1
//Definition der Funktion
+
        }),
signaldarstellung = brd1.create('functiongraph',[function(x){
+
        sldPHI2 = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], {
        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: '$\\phi_2=$',
    }], {strokeColor: "red"});
+
            unitLabel: 'Grad', snapWidth: 5
 
+
        }),
//Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
+
        sldT = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], {
p_T0=brd1.create('point', [function(){ return Math.round(getT0() *100)/100;},
+
            suffixlabel: '$t=$',
      function(){ return a.Value()*Math.cos(2*Math.PI*b.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*c.Value()/360)
+
            unitLabel: 's', snapWidth: 0.2
        +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:''})
+
        }),
p_T0h = brd1.create('point', [function(){ return Math.round(getT0() *100)/100;}, 2], {visible: false, color:"blue", fixed:true, label:false, size:1, name:''})
+
        // Definition der Funktion
l_T0 = brd1.create('line', [p_T0, p_T0h])
+
        signaldarstellung = pltBox.create('functiongraph', [function(x) {
 
+
            return (sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * x - 2 * Math.PI * sldPHI1.Value() / 360) + sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * x - 2 * Math.PI * sldPHI2.Value() / 360))
//Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
+
        }], {
    function getT0() {
+
            strokeColor: "red"
 
+
        });
        var A, B, C, Q;
+
        // Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
         if (b.Value() < e.Value()) {
+
        p_T0 = pltBox.create('point', [
            A = b.Value();
+
            function() {
             B = e.Value();
+
                return (Math.round(getT0() * 100) / 100);
        } else {
+
            },
            B = b.Value();
+
            function() {
            A = e.Value();
+
                return sldA1.Value() * Math.cos(2 * Math.PI * sldF1.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * sldPHI1.Value() / 360) +
 +
                    sldA2.Value() * Math.cos(2 * Math.PI * sldF2.Value() * (Math.round(getT0() * 100) / 100) - 2 * Math.PI * sldPHI2.Value() / 360);
 +
            }],
 +
            { 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;
 
+
            if (sldF1.Value() < sldF2.Value()) {
        for (var x = 1; x <= 100; x++) {
+
                A = sldF1.Value();
            C = A / x;
+
                B = sldF2.Value();
            Q = B / C;
+
            } else {
            console.log(x + '. Durchgang: C = ' + C, 'Q = ' + Q);
+
                B = sldF1.Value();
            if (isInt(Q)) {
+
                A = sldF2.Value();
                console.log('Q ist eine Qanzzahl!!! T0 ist damit ', 1 / C);
+
            }
                 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) {
+
        }
                 return 10;
+
        // Ausgabe des Wertes x(t)
 +
        setInterval(function() {
 +
             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() /
 +
                360)) * 1000) / 1000;
 +
        }, 50);
 +
        // Ausgabe des Wertes x(t+T_0)
 +
        setInterval(function() {
 +
            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;
 
             }
 
             }
             if ((1/C) > 10)
+
             document.getElementById("x_max").innerHTML = Math.max.apply(Math, x);
                return 10
+
        }, 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();
 
+
     };
    function isInt(n) {
 
         return n % 1 === 0;
 
    }
 
 
 
 
 
 
 
//Definition der Funktion zum An- und Ausschalten des Koordinatengitters
 
function showgrid() {
 
    if (gridbox.checked) {
 
      xaxis = brd1.create('axis', [[0, 0], [1,0]], {});
 
      yaxis = brd1.create('axis', [[0, 0], [0, 1]], {});
 
    } else {
 
    xaxis.removeTicks(xaxis.defaultTicks);
 
    yaxis.removeTicks(yaxis.defaultTicks);
 
    }
 
    brd1.fullUpdate();
 
};
 
</script>
 
</form>
 
 
 
<script>
 
 
 
//Definition des Reset-Buttons
 
function zurueck() {
 
     document.getElementById("myForm").reset();
 
};
 
 
</script>
 
</script>
 
 
</body>
 
</body>
 
</html>
 
</html>
 +
 +
{{Display}}

Version vom 18. September 2017, 23:06 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)$$

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