<< NARVAL_G_GraphSize NARVAL NARVAL_G_InternLinks >>

NARVAL >> NARVAL > NARVAL_G_HookeForce

NARVAL_G_HookeForce

Perform the force generated by the Hooke's attraction.

Calling Sequence

[Hx,Hy]=NARVAL_G_HookeForce(kh,i,j,nx,ny,l)

Parameters

kh :

Hooke coefficient.

i :

starting node.

j :

ending node.

nx :

current x-coordinates vector of nodes.

ny :

current y-coordinates vector of nodes.

l :

edge length at the equilibrium.

Hx :

x-coordinate of the Hooke's attraction.

Hy :

y-coordinate of the Hooke's attraction.

Description

NARVAL_G_HookeForce performs the Hooke's attraction [Hx,Hy] between two nodes [i,j] of a graph after their displacement. The position of all nodes is assumed to be stored in [nx,ny]. The edge length at the equilibrium is l. In respect with the Wikipedia definition, the Hooke's law of elasticity is an approximation that states that the extension of a spring is in direct proportion with the load applied to it.

Examples

n=3;//network size
l0=5;//a maximum of 5 links are created for any created node
L=1000;//network square area side 
kh=0.1;//Hooke's coefficient
[g,d]=NARVAL_T_BarabasiAlbert(n,l0,L);//generation of the topology
n=g.node_number;
l=length(g.head);
nx=g.node_x;//current position
ny=g.node_y;
li=NARVAL_F_AleaNombre(l);//selection of a link
[nd,nf]=NARVAL_G_Edge2Nodes(g,li);
le=50;//edge length at the equilibrium 
[Hx,Hy]=NARVAL_G_HookeForce(kh,nd,nf,nx,ny,le);//application of NARVAL_G_HookeForce
Hx
Hy

Dependency

NARVAL_F_Distance

Author

http://wwwen.uni.lu/interdisciplinary_centre_for_security_reliability_and_trust

Contact

<< NARVAL_G_GraphSize NARVAL NARVAL_G_InternLinks >>