Applets:Periodendauer periodischer Signale: Unterschied zwischen den Versionen

Aus LNTwww
Wechseln zu:Navigation, Suche
Zeile 47: Zeile 47:
 
</p>
 
</p>
 
<div id="plotBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:100px 20px 0px 0px;"></div>
 
<div id="plotBoxHtml" class="jxgbox" style="width:600px; height:600px; border:1px solid black; margin:100px 20px 0px 0px;"></div>
<div id="cnfBoxHtml" class="jxgbox" style="width:600px; height:150px; border:1px solid white; margin:-760px 20px 0px 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; border:1px solid white; margin:625px 20px 0px 0px;"></div>
+
<div id="outBoxHtml" class="jxgbox" style="width:600px; height:100px; margin:625px 20px 0px 0px;"></div>
  
 
</form>
 
</form>
Zeile 55: Zeile 55:
 
//Grundeinstellungen der beiden Applets
 
//Grundeinstellungen der beiden Applets
 
JXG.Options.text.useMathJax = true;
 
JXG.Options.text.useMathJax = true;
var brd1 = 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]});
+
var 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]});
var brd2 = 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]});
+
var 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]});
var brd3 = 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]});
+
var 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]});
brd2.addChild(brd1);
+
cnfBox.addChild(plotBox);
brd2.addChild(brd3);
+
cnfBox.addChild(outBox);
  
 
//Einstellungen der Achsen
 
//Einstellungen der Achsen
xaxis = brd1.create('axis', [[0, 0], [1,0]], {name:'\\[t/T\\]', withLabel:true, label:{position:'rt', offset:[-25, 15]}});
+
xaxis = plotBox.create('axis', [[0, 0], [1,0]], {name:'\\[t/T\\]', withLabel:true, label:{position:'rt', offset:[-25, 15]}});
yaxis = brd1.create('axis', [[0, 0], [0, 1]], {name:'\\[x(t)\\]', withLabel:true, label:{position:'rt', offset:[10, -5]}});
+
yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {name:'\\[x(t)\\]', withLabel:true, label:{position:'rt', offset:[10, -5]}});
  
 
//Festlegen der Schieberegler
 
//Festlegen der Schieberegler
a = brd2.create('slider',[[-0.7,1.5],[3,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
+
a = cnfBox.create('slider',[[-0.7,1.5],[3,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
b = brd2.create('slider',[[-0.7,0.5],[3,0.5],[0,1,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
+
b = cnfBox.create('slider',[[-0.7,0.5],[3,0.5],[0,1,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
c = brd2.create('slider',[[-0.7,-0.5],[3,-0.5],[-180,0,180]], {withLabel:false, withTicks:false, snapWidth:5}),
+
c = cnfBox.create('slider',[[-0.7,-0.5],[3,-0.5],[-180,0,180]], {withLabel:false, withTicks:false, snapWidth:5}),
d = brd2.create('slider',[[6,1.5],[9.7,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
+
d = cnfBox.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}),
+
e = cnfBox.create('slider',[[6,0.5],[9.7,0.5],[0,2,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
g = brd2.create('slider',[[6,-0.5],[9.7,-0.5],[-180,90,180]], {withLabel:false, withTicks:false, snapWidth:5}),
+
g = cnfBox.create('slider',[[6,-0.5],[9.7,-0.5],[-180,90,180]], {withLabel:false, withTicks:false, snapWidth:5}),
t = brd2.create('slider',[[-0.7,-1.5],[3,-1.5],[0,0,10]], {withLabel:false, withTicks:false, snapWidth:0.2}),
+
t = cnfBox.create('slider',[[-0.7,-1.5],[3,-1.5],[0,0,10]], {withLabel:false, withTicks:false, snapWidth:0.2}),
  
  
 
//Definition der Ausgabefelder
 
//Definition der Ausgabefelder
texta=brd2.create('text',[2.8,1.87, function()
+
texta=cnfBox.create('text',[2.8,1.87, function()
 
   { return '\\[A_1= '+ Math.round(a.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true, fontSize:14});
 
   { return '\\[A_1= '+ Math.round(a.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true, fontSize:14});
textb=brd2.create('text',[2.8,0.87, function()
+
textb=cnfBox.create('text',[2.8,0.87, function()
 
   { return '\\[f_1= '+ Math.round(b.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
 
   { return '\\[f_1= '+ Math.round(b.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
textc=brd2.create('text',[2.8,-0.13, function()
+
textc=cnfBox.create('text',[2.8,-0.13, function()
 
   { return '\\[\\phi_1= '+ Math.round(c.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true, fontSize:14});
 
   { return '\\[\\phi_1= '+ Math.round(c.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true, fontSize:14});
textd=brd2.create('text',[9.5,1.67, function()
+
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});
 
   { return '\\[A_2= '+ Math.round(d.Value()*100)/100 +' \\text{ V}\\]';}], {fixed:true, visible:true, fontSize:14});
texte=brd2.create('text',[9.5,0.67, function()
+
texte=cnfBox.create('text',[9.5,0.67, function()
 
   { return '\\[f_2= '+ Math.round(e.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
 
   { return '\\[f_2= '+ Math.round(e.Value()*100)/100 +' \\text{ kHz}\\]';}], {fixed:true, visible:true, fontSize:14});
textg=brd2.create('text',[9.5,-0.33, function()
+
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});
 
   { return '\\[\\phi_2= '+ Math.round(g.Value()*100)/100 +' \\text{ Grad}\\]';}], {fixed:true, visible:true, fontSize:14});
textt=brd2.create('text',[2.8,-1.2, function()
+
textt=cnfBox.create('text',[2.8,-1.2, function()
 
   { return '\\[t= '+ Math.round(t.Value()*100)/100 +' \\]';}], {fixed:true, visible:true, fontSize:14});
 
   { return '\\[t= '+ Math.round(t.Value()*100)/100 +' \\]';}], {fixed:true, visible:true, fontSize:14});
  
textergebnis1=brd3.create('text',[-1,1.5, function()
+
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});
 
   { 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});
textergebnis2=brd3.create('text',[1.5,1.5, function()
+
textergebnis2=outBox.create('text',[1.5,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, fontSize:14});
 
   { 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});
textergebnis3=brd3.create('text',[5,1.5, function()
+
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});
 
   { 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});
textergebnis4=brd3.create('text',[8.5,1.5, function()
+
textergebnis4=outBox.create('text',[8.5,1.5, function()
 
{var x = new Array(50000);
 
{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;};
 
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});
 
return '\\[x_{max}= '+ Math.max.apply(Math,x)+' \\]';}], {fixed:true, visible:true, fontSize:14});
textergebnis5=brd3.create('text',[10.8,1.5, function()
+
textergebnis5=outBox.create('text',[10.8,1.5, function()
 
   { return '\\[T_0= '+ Math.round(getT0() *100)/100 +' \\]';}], {fixed:true, visible:true, strokeColor:'blue', fontSize:14});
 
   { return '\\[T_0= '+ Math.round(getT0() *100)/100 +' \\]';}], {fixed:true, visible:true, strokeColor:'blue', fontSize:14});
  
 
//Definition der Funktion
 
//Definition der Funktion
signaldarstellung = brd1.create('functiongraph',[function(x){
+
signaldarstellung = plotBox.create('functiongraph',[function(x){
 
         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))
 
         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))
 
     }], {strokeColor: "red"});
 
     }], {strokeColor: "red"});
  
 
//Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
 
//Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
p_T0=brd1.create('point', [function(){ return Math.round(getT0() *100)/100;},
+
p_T0=plotBox.create('point', [function(){ return Math.round(getT0() *100)/100;},
 
       function(){ return a.Value()*Math.cos(2*Math.PI*b.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*c.Value()/360)
 
       function(){ return a.Value()*Math.cos(2*Math.PI*b.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*c.Value()/360)
 
         +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:''})
 
         +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:''})
+
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 = brd1.create('line', [p_T0, p_T0h])
+
l_T0 = plotBox.create('line', [p_T0, p_T0h])
  
 
//Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
 
//Bestimmung des Wertes T_0 mit der Funktion von Siebenwirth
Zeile 155: Zeile 155:
 
function showgrid() {
 
function showgrid() {
 
     if (gridbox.checked) {
 
     if (gridbox.checked) {
       xaxis = brd1.create('axis', [[0, 0], [1,0]], {});
+
       xaxis = plotBox.create('axis', [[0, 0], [1,0]], {});
       yaxis = brd1.create('axis', [[0, 0], [0, 1]], {});
+
       yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {});
 
     } else {
 
     } else {
 
     xaxis.removeTicks(xaxis.defaultTicks);
 
     xaxis.removeTicks(xaxis.defaultTicks);
 
     yaxis.removeTicks(yaxis.defaultTicks);
 
     yaxis.removeTicks(yaxis.defaultTicks);
 
     }
 
     }
     brd1.fullUpdate();
+
     plotBox.fullUpdate();
 
};
 
};
 
</script>
 
</script>

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