Clear Filters
Clear Filters

Wrong suming output in simulink r2023A

1 view (last 30 days)
Joshi Kumar V
Joshi Kumar V on 6 Apr 2024
Answered: Steven Lord on 6 Apr 2024
Greetings!
We are training a reinforcement learning agent using the R2023a version in Ubuntu 22.04 LTS. We have built a reward block that should result in a reward value of -150 when the input is under a particular range. We have observed that the input to the summing block in the reward function is of value -150 (-100, -50, 0, 0) while the output of the sum block is of value 106
When we tested with constant values, as shown in the attached image, the sum block resulted in a value of -150, as intended.
This has affected the training of agents drastically.

Answers (1)

Steven Lord
Steven Lord on 6 Apr 2024
I don't work with Simulink that much, but I'd check the data types of the various signals in your code.
106 - (-150)
ans = 256
The fact that these two numbers differ by a power of 2 makes me suspicious that there's some conversion with wrapping going on.

Community Treasure Hunt

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

Start Hunting!