A linear encoder is a device that uses one or more motors to provide rotational input to a drive shaft…