How to deal with incremental shaft encoder?

23 views (last 30 days)
Varanasi
Varanasi on 5 Oct 2025 at 10:32
Edited: Nidhi on 21 Oct 2025 at 7:06
I have a physical setup which has incremental encoder. I want to simulate in simulink but, on using incremental shaft encoder block there is some error in the angle output from it on comparing with the ideal angular motion sensor. How do i model an incremental shaft encoder in simulink?

Accepted Answer

Nidhi
Nidhi on 17 Oct 2025 at 12:47
Edited: Nidhi on 21 Oct 2025 at 7:06
Hi Varanasi,
I understand that you want to accurately simulate an incremental shaft encoder in Simulink, but you are seeing an error in the angle output compared to an ideal angular motion sensor.
Reasons for the error:
  • The incremental shaft encoder block simulates a real encoder, which only detects discrete pulses as the shaft rotates, not a continuous angle. This means the measured angle is quantized and can have resolution errors compared to an ideal sensor.
  • The resolution of the encoder (number of pulses per revolution) and the sampling time of your simulation can both affect the accuracy of the output.
How to model an incremental shaft encoder in Simulink:
  1. Set Encoder Resolution Appropriately: Make sure the “Pulses per revolution” parameter in the Incremental Shaft Encoder block matches your real encoder’s specification. A higher value gives finer resolution and less quantization error.
  2. Check Simulation Step Size: Use a small enough simulation step size so that the encoder can detect all pulses. If the step size is too large, some pulses may be missed, causing errors.
  3. Compare With Ideal Sensor: It is normal to see small differences when you compare the incremental encoder output to an ideal sensor because the encoder quantizes the angle.
  4. Model Real-World Effects (Optional): If you want to include more realistic behaviour, you can add noise, missed pulses, or other imperfections using additional Simulink blocks.
For more information, please refer to the official documentation: https://www.mathworks.com/help/physmod/sps/ref/incrementalshaftencoder.html
I hope this helps!
  1 Comment
Varanasi
Varanasi on 21 Oct 2025 at 4:35
Hi Nidhi
Thanks for your answer, but i also found that in positive direction the output of encoder block i almost the same as in ideal sensor but in negative direction the error was increasing. And i used decoder block along with encoder block and didnt connect Z pulses to the decoder.

Sign in to comment.

More Answers (0)

Products


Release

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!