Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //federgraph-special-sample-scilab-3D.sce
- //this file contains code for scilab 5.5.1
- //the sample contains the special case, see federgraph.blogspot.de
- funcprot(0)
- function z = f(x, y)
- //the terms under the root
- a1 = (x-x1)^2 + (y-y1)^2;
- a2 = (x-x2)^2 + (y-y2)^2;
- a3 = (x-x3)^2 + (y-y3)^2;
- //actual length of springs
- t1 = sqrt(a1);
- t2 = sqrt(a2);
- t3 = sqrt(a3);
- //expansion of springs
- f1 = (t1-l);
- f2 = (t2-l);
- f3 = (t3-l);
- //x-components of force
- u1 =f1 * (x-x1) / t1;
- u2 =f2 * (x-x2) / t2;
- u3 =f3 * (x-x3) / t3;
- //y-components of force
- v1 = f1 * (y-y1) / t1;
- v2 = f2 * (y-y2) / t2;
- v3 = f3 * (y-y3) / t3;
- //sum of components
- u = u1 + u2 + u3;
- v = v1 + v2 + v3;
- //absolute value of resultant force
- z = sqrt(u^2 + v^2);
- endfunction
- funcprot(0)
- //de.wikipedia.org/wiki/Gleichseitiges_Dreieck
- //setup of the constant equilateral triangle
- a = 100; //side length
- w3 = sqrt(3); //Wurzel 3
- h = w3/2 * a; //height
- ro = w3/3 * a; //radius of outer circle
- ri = w3/6 * a; //radius of inner circle
- //coordinates of the triangle, where the springs are attached
- x1 = -a/2;
- x2 = a/2;
- x3 = 0;
- y1 = -ri;
- y2 = -ri;
- y3 = ro;
- l = h;
- clf()
- n = 128; //number of points
- x=linspace(-100,100,n);
- y=linspace(-100,100,n);
- z=feval(x,y,f)';
- surf(x, y, z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement