1. A method of determining an attitude matrix on a portable electronic device, comprising: determining a first attitude matrix gradient using data from at least one of an accelerometer and a magnetometer; determining a second attitude matrix gradient using data from a gyroscope; fusing the first attitude matrix gradient and the second attitude matrix gradient based on a mixing coefficient to generate a fused gradient; and based on the fused gradient, updating a fine attitude matrix for the portable electronic device.