mloop: Simulate (Make) a Hysteresis Loop

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mloop.r

Description

Simulate a hysteresis loop with a variety of possible parameters.

Usage

1
2
3
4
5
6
mloop(cx = 0, cy = 0, retention = 0.2, b.x = 0.6, b.y = 0.8,n = 1, m = 1, 
     sd.x = 0, sd.y = 0, phase.angle = 0, n.points = 24, 
    period = 24,extended.classical=FALSE,seed=NULL)  
mloop2r(cx=0,cy=0,retention.above=0.2,retention.below=0.15,b.x=0.6,b.y=0.8,n=1,
        m=1,sd.x=0,sd.y=0,phase.angle=0,n.points=24,period=24,
        extended.classical=FALSE,seed=NULL)

Arguments

n

Positive integer for the split line parameter. If n=1, split line is linear; If n is even, split line has a u shape; If n is odd and higher than 1, split line has a chair or classical shape.

m

Positive odd integer for the bulging parameter, indicates degree of outward curving (1=highest level of bulging).

b.x

number. Saturation point x coordinate. Horizontal distance from the center to the maximum value of the input challenge.

b.y

number. Saturation point y coordinate. Vertical distance from the center to the point where the input is at its maximum.

phase.angle

number in degrees. Defines the starting point of the loop. The initial angle of the input function at its origin.

cx

number. Center of input x.

cy

number. Center of output y.

retention

number. Split point, represents vertical distance from center to upper loop trajectory. It is the intersection of the loop and the output axis characterizing the distortion in the response at the average input challenge. Assumes symmetrical curve above and below split line.

retention.above

number. Retention above the split line. mloop2r creates a loop where retention above and below the split line may be different.

retention.below

number. Retention below the split line.

sd.x

number. Standard deviation of the normally distributed variation in the input vector x.

sd.y

number. Standard deviation of the normally distributed variation in the output vector y.

n.points

number of points on loop.

period

number of equally spaced points required to make a full loop.

extended.classical

logical. If true, fit a classical hysteresis loop regardless of n. Uses

y_t=sign(cos(2*pi*t/period))*b.y*abs(cos(2*pi*t/period))^n + retention*sin(2*pi*t/period)^m+cy+e_{y,t}

instead of

y_t=b.y*cos(2*pi*t/period)^n+retention*sin(2*pi*t/period)^m+cy+e_{y,t}

Allows the user to fit classical loops with any n>1 instead of just odd numbered n. Default is false.

seed

integer. Starting seed.

Details

Simulates input and output variables x and y that form a hysteresis loop of the form

x_t=b.x*cos(2pi*t/period+phase.angle)+cx+e_{x,t}

y_t=b.y*cos(2pi*t/period+phase.angle)^n+retention*sin(2pi*t/period+phase.angle)^m+cy+e_{y,t}

where

t=0,...,n.points-1 if times='equal'

and the error terms e are normally distributed. Also produces a vector of derived values.

Value

mloop returns an object of class hysteresisloop.

values

estimated values of various coefficients and derived parameters of the hysteresis loop. See loop.parameters

x

the input x.

y

the output y.

Author(s)

Spencer Maynes, Fan Yang, and Anne Parkhurst.

References

Lapshin, R. (1995) Analytical model for the approximation of hysteresis loop and its application to the scanning tunneling microscope.

See Also

Fit a hysteresis loop with the function floop.

Examples

1
2
3
4
5
6
7
#Simulate a loop with n=3, m=1, retention=0.9
loop1 <- mloop(cx=5,cy=8,retention=0.9,sd.x=0.01,sd.y=0.05,n=3,m=1)
loopmodel <- floop(loop1$x,loop1$y,n=3,m=1)
loopmodel 
##Plot hysteresis loop.
plot(loopmodel,main="Simulated Hysteresis Loop n=3 m=1",xlab="Input",
ylab="Output",values="hysteresis.all")

hysteresis documentation built on May 15, 2021, 1:09 a.m.