Test

Aus Wiki1

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 2: Zeile 2:
         var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5,5,5,-5], axis:true});
         var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5,5,5,-5], axis:true});
-
 
-
        // Define the metal plate as a polygon
 
-
        var polygon = board.create('polygon', [[-4,-4], [-4,4], [4,4], [4,-4]], {fillcolor:'#ddd', hasInnerPoints:true});
 
-
 
-
        // Define the initial temperature distribution as a function of x and y
 
-
        function initialTemp(x,y) {
 
-
            return 20 + 10*Math.sin(Math.PI*x/4)*Math.sin(Math.PI*y/4);
 
-
        }
 
-
 
-
        // Define the temperature function as a function of x and y and time
 
-
        function temp(x,y,t) {
 
-
            var k = 1;
 
-
            var c = 1;
 
-
            var rho = 1;
 
-
            var alpha = k/(rho*c);
 
-
            return initialTemp(x,y) + 10*Math.exp(-alpha*Math.PI*Math.PI*t/16)*Math.sin(Math.PI*x/4)*Math.sin(Math.PI*y/4);
 
-
        }
 
-
 
-
        // Create a grid of points to sample the temperature function
 
-
        var points = [];
 
-
        for (var i=-4; i<=4; i+=0.5) {
 
-
            for (var j=-4; j<=4; j+=0.5) {
 
-
                points.push([i,j]);
 
-
            }
 
-
        }
 
-
 
-
        // Plot the temperature distribution at time t=0
 
-
        var heatmap = board.create('polygon', [points, initialTemp], {colorscheme:'greyscale', minopacity:0.5});
 
-
 
-
        // Animate the temperature distribution over time
 
-
        var time = 0;
 
-
        var dt = 0.1;
 
-
        var interval = setInterval(function() {
 
-
            time += dt;
 
-
            var values = [];
 
-
            for (var i=0; i<points.length; i++) {
 
-
values.push(temp(points[i][0], points[i][1], time));
 
-
    }
 
-
heatmap.updateData(values);
 
-
            if (time >= 2) clearInterval(interval);
 
-
        }, 100);
 
var r=3;
var r=3;
var p0=[];
var p0=[];
var p0[1]=board.create('point', [2.0, 2.0]),
var p0[1]=board.create('point', [2.0, 2.0]),
-
     c1 = board.create('circle', [p1, r]);
+
     c1 = board.create('circle', [p0[1], r]);
</jsxgraph>
</jsxgraph>

Version vom 17:01, 8. Dez. 2025

Persönliche Werkzeuge