fix: iq_applet

This commit is contained in:
Matthias Jung
2026-07-23 13:25:56 +02:00
parent 638a6c7298
commit 3e568455d1
+7 -7
View File
@@ -3,9 +3,9 @@
<script src="https://www.50ohm.de/assets/jquery/3.7.1/jquery.min.js"></script> <script src="https://www.50ohm.de/assets/jquery/3.7.1/jquery.min.js"></script>
<script src="https://www.50ohm.de/assets/chartjs/4.4.1/chart.min.js"></script> <script src="https://www.50ohm.de/assets/chartjs/4.4.1/chart.min.js"></script>
Das Ganze lässt sich leicht mathematisch beschreiben. Für die Summe eines Sinus-Trägers mit einem anderen um $\qty{90}{\degree}$ phasenverschoben Sinus-Träger gilt folgender Zusammenhang:<br><br> Das Ganze lässt sich leicht mathematisch beschreiben. Für die Summe eines Cosinus-Trägers mit einem anderen, um $\qty{90}{\degree}$ phasenverschobenen Cosinus-Träger gilt folgender Zusammenhang:<br><br>
<center>$ I(t)\cdot \sin\left(\omega t\right) + Q(t)\cdot \sin\left(\omega t + \qty{90}{\degree}\right)=A \cdot \sin\left(\omega t+\phi\right) $</center><br><br> <center>$ I(t)\cdot \cos\left(\omega t\right) + Q(t)\cdot \cos\left(\omega t + \qty{90}{\degree}\right)=A \cdot \cos\left(\omega t+\phi\right) $</center><br><br>
Es entsteht ein, also ein neues Sinussignal mit einer Amplitude von $A=\sqrt{I(t)^2 + Q(t)^2}$ und einer Phasenverschiebung von $ \phi = \arctan\left(\frac{Q(t)}{I(t)}\right)$<br><br> Es entsteht also ein neues Cosinussignal mit einer Amplitude von $A=\sqrt{I(t)^2 + Q(t)^2}$ und einer Phasenverschiebung von $ \phi = \operatorname{atan2}\left(Q(t),I(t)\right)$<br><br>
<table> <table>
<tr> <tr>
<td> <td>
@@ -221,12 +221,12 @@
// Generate new Data: // Generate new Data:
for (let x = i1; x <= i2; x += step) { for (let x = i1; x <= i2; x += step) {
// Set I: // Set I:
iq.data.datasets[0].data.push(i*Math.sin(x)); iq.data.datasets[0].data.push(i*Math.cos(x));
iq.data.labels.push(x); iq.data.labels.push(x);
// Set Q: // Set Q:
iq.data.datasets[1].data.push(q*Math.sin(x+Math.PI/2)); iq.data.datasets[1].data.push(q*Math.cos(x+Math.PI/2));
// Set Sum: // Set Sum:
sum.data.datasets[0].data.push(i*Math.sin(x) + q*Math.sin(x+Math.PI/2)); sum.data.datasets[0].data.push(i*Math.cos(x) + q*Math.cos(x+Math.PI/2));
sum.data.labels.push(x); sum.data.labels.push(x);
} }
@@ -239,7 +239,7 @@
$('#ipercent').html(i+"%"); $('#ipercent').html(i+"%");
$('#qpercent').html(q+"%"); $('#qpercent').html(q+"%");
$('#ares').html(Math.round(Math.sqrt(i*i+q*q))+"%"); $('#ares').html(Math.round(Math.sqrt(i*i+q*q))+"%");
$('#phires').html(Math.round((Math.atan2(i,q)*180)/Math.PI)+"&deg;"); $('#phires').html(Math.round((Math.atan2(q,i)*180)/Math.PI)+"&deg;");
} }
</script> </script>