A type of fixed integral interval sliding method for optimization-based alignment is proposed in this paper. The method is more reasonable and suitable than those in the references due to the appropriate treatment of the noise in the outputs of the Inertial Measurement Unit (IMU). The undesired sensor noise of sensors includes both random noise and bias. Our optimal alignment is based on an integrated form where the bias will be integrated during the process of alignment. In this respect, the length of the integrated data is a key factor in determining current attitude due to the ambivalent effect of integrating the sensor noise. If the length is too great the precision deteriorates due to the integration of bias. If the length is too small the precision also deteriorates because of the randomness of the noise. The validity of the method is verified by simulation and measured data.