A method to calculate the shape of mask slots of an optical incremental encoder, comprising: emitting, by a light source, a light beam, said light beam being collimated by a lens and reaching a rotating disk producing a diffraction effect, said rotating disk being positioned perpendicular to a rotating axis, fixed to the latter, and rotating at a same velocity, said rotating disk having a first part in the periphery thereof comprising a plurality of disk slots having a rectangular shape allowing light to go through and a second part not allowing the light to go through; receiving, by a mask positioned at a certain distance after the rotating disk and comprising a plurality of mask slots with a particular shape, the light diffracted by the rotating disk; and generating, by an optoelectronic unit, a periodic signal with a given first resolution using an amount of light reaching the optoelectronic unit after having passed through the rotating disk and the mask, said amount of light being dependent on the rotation of the rotating disk; and characterized in that the method further comprises: converting, by the optoelectronic unit, said generated periodic signal into an electronic pulse which is processed to obtain a final output with a given second resolution, said final output being used to calculate the speed of the rotating axis; and in that the shape of the mask slots is calculated by performing a Fourier transform on a convolution equation relating a function H, a function F and a sinusoidal function, by ignoring the effects of diffraction occurring in the rotating disk, so that said generated periodic signal being a pure sinusoidal signal, where the function H defines the rectangular shape of the disk slots and the function F defines the shape of the mask slots, wherein said calculation of the shape of the mask slots being performed by using the following equation ( F ∗ H)( t) = ∫ F ( x) H ( x - t) dx = c (1 + sin Nt), in which only the positive part of the sinusoidal function is considered, where c is a constant, and N is the first resolution of the generated periodic signal. emitting, by a light source, a light beam, said light beam being collimated by a lens and reaching a rotating disk producing a diffraction effect, said rotating disk being positioned perpendicular to a rotating axis, fixed to the latter, and rotating at a same velocity, said rotating disk having a first part in the periphery thereof comprising a plurality of disk slots having a rectangular shape allowing light to go through and a second part not allowing the light to go through; receiving, by a mask positioned at a certain distance after the rotating disk and comprising a plurality of mask slots with a particular shape, the light diffracted by the rotating disk; and generating, by an optoelectronic unit, a periodic signal with a given first resolution using an amount of light reaching the optoelectronic unit after having passed through the rotating disk and the mask, said amount of light being dependent on the rotation of the rotating disk; and characterized in that the method further comprises: converting, by the optoelectronic unit, said generated periodic signal into an electronic pulse which is processed to obtain a final output with a given second resolution, said final output being used to calculate the speed of the rotating axis; and in that the shape of the mask slots is calculated by performing a Fourier transform on a convolution equation relating a function H, a function F and a sinusoidal function, by ignoring the effects of diffraction occurring in the rotating disk, so that said generated periodic signal being a pure sinusoidal signal, where the function H defines the rectangular shape of the disk slots and the function F defines the shape of the mask slots, wherein said calculation of the shape of the mask slots being performed by using the following equation ( F ∗ H)( t) = ∫ F ( x) H ( x - t) dx = c (1 + sin Nt), in which only the positive part of the sinusoidal function is considered, where c is a constant, and N is the first resolution of the generated periodic signal.