Compiled Simulink model of transfer function block giving different results
8 views (last 30 days)
Show older comments
I have a very simple model that consists of an input port, a transfer function and an output port. The model is attached to this question in case you want to check it.
The inputs for the first three steps are { -60.982112667828780, -60.781022873413790,60.168975966495110 }.
The outputs in Simulink are: {0, -0.003033557714140, -0.012065510055461}
While in the C code I get the following results: {0, 0, -0.0060982112667828780}.
I have read the answer to a simular question posted here: https://www.mathworks.com/matlabcentral/answers/90341-compiled-simulink-model-giving-different-results
So I unchecked the Single output/update function option in order to have them separated.
I don't know what is causing my results to be so different in Simulink and the generated C code. Does anybody have any idea?
2 Comments
Birdman
on 7 Dec 2017
One simple question: What is your sampling rate for discretizing your transfer function while generating C code?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!