A matrix coil for generating a variable magnetic field is provided,
including a plurality of loops arranged in a series so as to have a
substantially common axis and segmented into at least one arc-shaped
segment, a variable current source for each of the arc-shaped segments,
and a controller. The controller is configured to selectively vary an
amount of current provided to each of the arc-shaped segments by the
variable current sources so as to achieve a variable base field, one or
more variable gradient fields, and one or more variable second order shim
fields.