a linear sensor uses four spaced apart magnets arranged in a rectangular array and has an axis of symmetry . each magnet has a staircase shape of at least two steps ascending towards a centerline . each magnet of the array has a single n - s with magnets arranged as mirror images about the axis of symmetry having opposed poles , and magnets located on diagonals defined by the rectangular array having the same pole facing the axis of symmetry . the linear sensor employs a magnetic field sensor such as a programmable hall effect sensor that is mounted for movement relative to the magnetic array along the axis of symmetry . the height of the steps defining the staircase shape of the magnets is selected to produce a magnetic field of selected linearity along a selected portion of the axis of symmetry .