<< NL_G_HighlightTreeLeaves NL_G: Graph NL_G_InternalLinks >>

NARVAL >> NL_G: Graph > NL_G_HookeForce

NL_G_HookeForce

Perform the force generated by the Hooke's attraction.

Calling Sequence

[Hx,Hy] = NL_G_HookeForce(K,I,J,X,Y,L)

Arguments

K :

Hooke coefficient.

I :

Starting node.

J :

Ending node.

X :

X-coordinates vector of nodes.

Y :

Y-coordinates vector of nodes.

L :

Edge length at the equilibrium.

:

X-coordinate of the Hooke's attraction.

:

Y-coordinate of the Hooke's attraction.

Description

NL_G_HookeForce performs the Hooke's attraction between the two nodes I and J of a graph after their displacement. The position of all nodes is assumed to be stored in [X,Y]. The edge length at the equilibrium is L. 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 (WIKIPEDIA).

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]=NL_T_BarabasiAlbert(n,l0,L);//generation of the topology
n=g.node_number;//real network size
l=length(g.head);//number of links
nx=g.node_x;//current position
ny=g.node_y;
li=NL_F_RandInt1n(l);//selection of a link
[nd,nf]=NL_G_Edge2Nodes(g,li);//edge index
le=50;//edge length at the equilibrium 
[Hx,Hy]=NL_G_HookeForce(kh,nd,nf,nx,ny,le)//application of NL_G_HookeForce

Dependency

NL_F_DistanceNiNj

Report an issue
<< NL_G_HighlightTreeLeaves NL_G: Graph NL_G_InternalLinks >>