|
CIRCULAR SHIFTName:
For example, to circular shift the contents of the variable Y that contains 5 elements up (or right) by one element into the output vector Y2, we mean
Y(2) => Y2(3) Y(3) => Y2(4) Y(4) => Y2(5) Y(5) => Y2(1) To shift the contents of Y down (or left) by one element, we mean
Y(2) => Y2(1) Y(3) => Y2(2) Y(4) => Y2(3) Y(5) => Y2(4) The SHIFT command is similar to the CIRCULAR SHIFT, but it handles the end points differently.
where <x> is a response variable; <nshift> is a number or parameter that specifies how how many elements to shift; and <y> is a variable that contains the shifted values. The sign of NSHIFT specifies the direction. If NSHIFT is negative, the shift is down (or left) and if NSHIFT is positive the shift is up (or right). If NSHIFT is zero, then Y = X.
let y = normal random numbers for i = 1 1 10
let nshift = 3
let y2 = circular shift y nshift
let nshift = -3
let y3 = circular shift y nshift
set write decimals 3
print y y2 y3
The following output is generated:
Date created: 6/19/2009 |