Applets:Periodendauer periodischer Signale: Unterschied zwischen den Versionen

Aus LNTwww
Wechseln zu:Navigation, Suche
Zeile 47: Zeile 47:
 
<script type="text/javascript">
 
<script type="text/javascript">
 
function drawNow() {
 
function drawNow() {
//Grundeinstellungen der beiden Applets
+
    // Grundeinstellungen der beiden Applets
JXG.Options.text.useMathJax = true;
+
    JXG.Options.text.useMathJax = true;
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]});
+
    cnfBox = JXG.JSXGraph.initBoard('cnfBoxHtml', {
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]});
+
        showCopyright: false, showNavigation: false, axis: false,
cnfBox.addChild(plotBox);
+
        grid: false, zoom: { enabled: false }, pan: { enabled: false },
 +
        boundingbox: [-1, 2.2, 12.4, -2.2]
 +
    });
 +
    pltBox = JXG.JSXGraph.initBoard('pltBoxHtml', {
 +
        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]
 +
    });
 +
    cnfBox.addChild(pltBox);
  
 +
    // Einstellungen der Achsen
 +
    xaxis = pltBox.create('axis', [[0, 0], [1, 0]], {
 +
        name: '$\\dfrac{t}{T}$',
 +
        withLabel: true, label: { position: 'rt', offset: [-25, -10] }
 +
    });
 +
    yaxis = pltBox.create('axis', [[0, 0], [0, 1]], {
 +
        name: '$x(t)$',
 +
        withLabel: true, label: { position: 'rt', offset: [10, -5] }
 +
    });
  
//Einstellungen der Achsen
+
    // Erstellen der Schieberegler
xaxis = plotBox.create('axis', [[0, 0], [1,0]], {name:'\\[t/T\\]', withLabel:true, label:{position:'rt', offset:[-25, 15]}});
+
    sldA1 = cnfBox.create('slider', [ [-0.7, 1.5], [3, 1.5], [0, 0.5, 1] ], {
yaxis = plotBox.create('axis', [[0, 0], [0, 1]], {name:'\\[x(t)\\]', withLabel:true, label:{position:'rt', offset:[10, -5]}});
+
        suffixlabel: '$A_1=$',
 +
        unitLabel: 'V', snapWidth: 0.01
 +
        }),
 +
    sldF1 = cnfBox.create('slider', [ [-0.7, 0.5], [3, 0.5], [0, 1, 10] ], {
 +
        suffixlabel: '$f_1=$',
 +
        unitLabel: 'kHz', snapWidth: 0.1
 +
    }),
 +
    sldPHI1 = cnfBox.create('slider', [ [-0.7, -0.5], [3, -0.5], [-180, 0, 180] ], {
 +
        suffixlabel: '$\\phi_1=$',
 +
        unitLabel: 'Grad', snapWidth: 5
 +
    }),
 +
    sldA2 = cnfBox.create('slider', [ [6, 1.5], [9.7, 1.5], [0, 0.5, 1] ], {
 +
        suffixlabel: '$A_2=$',
 +
        unitLabel: 'V', snapWidth: 0.01
 +
    }),
 +
    sldF2 = cnfBox.create('slider', [ [6, 0.5], [9.7, 0.5], [0, 2, 10] ], {
 +
        suffixlabel: '$f_2=$',
 +
        unitLabel: 'kHz', snapWidth: 0.1
 +
    }),
 +
    sldPHI2 = cnfBox.create('slider', [ [6, -0.5], [9.7, -0.5], [-180, 90, 180] ], {
 +
        suffixlabel: '$\\phi_2=$',
 +
        unitLabel: 'Grad', snapWidth: 5
 +
    }),
 +
    sldT = cnfBox.create('slider', [ [-0.7, -1.5], [3, -1.5], [0, 0, 10] ], {
 +
        suffixlabel: '$t=$',
 +
        unitLabel: 's', snapWidth: 0.2
 +
    }),
  
//Festlegen der Schieberegler
 
a = cnfBox.create('slider',[[-0.7,1.5],[3,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
 
b = cnfBox.create('slider',[[-0.7,0.5],[3,0.5],[0,1,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
 
c = cnfBox.create('slider',[[-0.7,-0.5],[3,-0.5],[-180,0,180]], {withLabel:false, withTicks:false, snapWidth:5}),
 
d = cnfBox.create('slider',[[6,1.5],[9.7,1.5],[0,0.5,1]], {withLabel:false, withTicks:false, snapWidth:0.01}),
 
e = cnfBox.create('slider',[[6,0.5],[9.7,0.5],[0,2,10]], {withLabel:false, withTicks:false, snapWidth:0.1}),
 
g = cnfBox.create('slider',[[6,-0.5],[9.7,-0.5],[-180,90,180]], {withLabel:false, withTicks:false, snapWidth:5}),
 
t = cnfBox.create('slider',[[-0.7,-1.5],[3,-1.5],[0,0,10]], {withLabel:false, withTicks:false, snapWidth:0.2}),
 
  
 
//Definition der Funktion
 
//Definition der Funktion
 
signaldarstellung = plotBox.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 (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"});
  
 
//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=plotBox.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 sldA1.Value()*Math.cos(2*Math.PI*sldF1.Value()*(Math.round(getT0() *100)/100)-2*Math.PI*sldPHI1.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:''})
+
         +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 = plotBox.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 = plotBox.create('line', [p_T0, p_T0h])
 
l_T0 = plotBox.create('line', [p_T0, p_T0h])
 +
 +
 +
    // Definition der Funktion
 +
    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))
 +
    }], {
 +
        strokeColor: "red"
 +
    });
 +
 +
    // Definition des Punktes p_T0, des Hilfspunktes p_T0h und der Geraden l_T0 für Periodendauer T_0
 +
    p_T0 = pltBox.create('point', [
 +
        function() {
 +
            return (Math.round(getT0() * 100) / 100);
 +
        },
 +
        function() {
 +
            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])
 +
   
 +
 +
 +
 +
 +
  
 
};
 
};
Zeile 84: Zeile 150:
  
 
         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();
 
         }
 
         }
  

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