Maybe you can provide detailed formulas for the encode and decode functions, as per the example file the calculations are not consistent with the actual run.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1518281/image.png)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!