Applets:Periodendauer periodischer Signale: Unterschied zwischen den Versionen
Aus LNTwww
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> | |
.button { | .button { | ||
background-color: black; | background-color: black; | ||
Zeile 21: | Zeile 28: | ||
background-color: #939393; | background-color: #939393; | ||
} | } | ||
− | + | </style> | |
− | |||
− | |||
− | |||
− | |||
</head> | </head> | ||
− | |||
− | |||
<body onload="drawNow()"> | <body onload="drawNow()"> | ||
− | <!-- Resetbutton, Checkbox | + | <!-- 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: | + | <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:-10px | + | <div id="pltBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:-100px 20px 10px 0px;"></div> |
<!-- Ausgabefelder --> | <!-- Ausgabefelder --> | ||
+ | |||
<table> | <table> | ||
<tr> | <tr> | ||
− | <td>$x(t)$= | + | <td>$x(t)$= <span id="x(t)"></span> $\quad$ </td> |
− | <td>$x(t+ T_0)$=<span id="x(t+T_0)"></span> </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></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> | |
− | <td>$x_{\text{max}}$=<span id="x_max"></span></td> | ||
− | <td>$T_0$= | ||
</tr> | </tr> | ||
</table> | </table> | ||
Zeile 54: | Zeile 54: | ||
<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; | ||
Zeile 78: | Zeile 78: | ||
}); | }); | ||
// Erstellen der Schieberegler | // Erstellen der Schieberegler | ||
− | + | sldA1 = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], { | |
suffixlabel: '$A_1=$', | suffixlabel: '$A_1=$', | ||
unitLabel: 'V', snapWidth: 0.01 | unitLabel: 'V', snapWidth: 0.01 | ||
}), | }), | ||
− | + | sldF1 = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], { | |
suffixlabel: '$f_1=$', | suffixlabel: '$f_1=$', | ||
unitLabel: 'kHz', snapWidth: 0.1 | unitLabel: 'kHz', snapWidth: 0.1 | ||
}), | }), | ||
− | + | sldPHI1 = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], { | |
suffixlabel: '$\\phi_1=$', | suffixlabel: '$\\phi_1=$', | ||
unitLabel: 'Grad', snapWidth: 5 | unitLabel: 'Grad', snapWidth: 5 | ||
}), | }), | ||
− | + | sldA2 = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 1] ], { | |
suffixlabel: '$A_2=$', | suffixlabel: '$A_2=$', | ||
unitLabel: 'V', snapWidth: 0.01 | unitLabel: 'V', snapWidth: 0.01 | ||
}), | }), | ||
− | + | sldF2 = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], { | |
suffixlabel: '$f_2=$', | suffixlabel: '$f_2=$', | ||
unitLabel: 'kHz', snapWidth: 0.1 | unitLabel: 'kHz', snapWidth: 0.1 | ||
}), | }), | ||
− | + | sldPHI2 = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], { | |
suffixlabel: '$\\phi_2=$', | suffixlabel: '$\\phi_2=$', | ||
unitLabel: 'Grad', snapWidth: 5 | unitLabel: 'Grad', snapWidth: 5 | ||
}), | }), | ||
− | + | sldT = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], { | |
suffixlabel: '$t=$', | suffixlabel: '$t=$', | ||
unitLabel: 's', snapWidth: 0.2 | unitLabel: 's', snapWidth: 0.2 | ||
Zeile 108: | Zeile 108: | ||
// Definition der Funktion | // Definition der Funktion | ||
signaldarstellung = pltBox.create('functiongraph', [function(x) { | signaldarstellung = pltBox.create('functiongraph', [function(x) { | ||
− | return ( | + | 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)) |
}], { | }], { | ||
strokeColor: "red" | strokeColor: "red" | ||
Zeile 118: | Zeile 118: | ||
}, | }, | ||
function() { | function() { | ||
− | return | + | 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: '' } | { color: "blue", fixed: true, label: false, size: 1, name: '' } | ||
Zeile 137: | Zeile 137: | ||
function getT0() { | function getT0() { | ||
var A, B, C, Q; | var A, B, C, Q; | ||
− | if ( | + | if (sldF1.Value() < sldF2.Value()) { |
− | A = | + | A = sldF1.Value(); |
− | B = | + | B = sldF2.Value(); |
} else { | } else { | ||
− | B = | + | B = sldF1.Value(); |
− | A = | + | A = sldF2.Value(); |
} | } | ||
// console.log('Berechne T0 mit A=' + A, 'B=' + B); | // console.log('Berechne T0 mit A=' + A, 'B=' + B); | ||
Zeile 162: | Zeile 162: | ||
// Ausgabe des Wertes x(t) | // Ausgabe des Wertes x(t) | ||
setInterval(function() { | setInterval(function() { | ||
− | document.getElementById("x(t)").innerHTML = Math.round(( | + | 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; | 360)) * 1000) / 1000; | ||
}, 50); | }, 50); | ||
// Ausgabe des Wertes x(t+T_0) | // Ausgabe des Wertes x(t+T_0) | ||
setInterval(function() { | setInterval(function() { | ||
− | document.getElementById("x(t+T_0)").innerHTML = Math.round(( | + | 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) - | + | Math.round(getT0() * 1000) / 1000) - sldPHI2.Value())) * 1000) / 1000; |
}, 50); | }, 50); | ||
// Ausgabe des Wertes x(t+2T_0) | // Ausgabe des Wertes x(t+2T_0) | ||
setInterval(function() { | setInterval(function() { | ||
− | document.getElementById("x(t+2T_0)").innerHTML = Math.round(( | + | 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) - | + | 2 * Math.round(getT0() * 1000) / 1000) - sldPHI2.Value())) * 1000) / 1000; |
}, 50); | }, 50); | ||
// Ausgabe des Wertes x_max | // Ausgabe des Wertes x_max | ||
Zeile 179: | Zeile 179: | ||
var x = new Array(50000); | var x = new Array(50000); | ||
for (var i = 0; i < 50001; i++) { | for (var i = 0; i < 50001; i++) { | ||
− | x[i] = Math.round(( | + | 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); | document.getElementById("x_max").innerHTML = Math.max.apply(Math, x); |
Version vom 18. September 2017, 16:38 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$ |