User`s guide
Quick Start Tutorials
3-29
Comparing Numerical Results of the Simulation
and the Generated Program
Your Simulink simulations and the generated code should produce nearly
identical output.
You have now obtained data from a Simulink run of the model, and from a
run of the program generated from the model. It is a simple matter to
compare the
f14rtw model output to the results achieved by Real-Time
Workshop.
Comparing
Angle_of_attack (simulation output) to rt_Angle_of_attack
(generated program output) produces
max(abs(rt_Angle_of_attack-Angle_of_attack))
ans =
1.0e-015 *
0 0.3331
Comparing Pilot_G_force (simulation output) to rt_Pilot_G_force
(generated program output) produces
max(abs(rt_Pilot_G_force-Pilot_G_force))
1.0e-013 *
0 0.6395
Overall agreement is within 10
-13
. The means of residuals are an order of
magnitude smaller. This slight error can be caused by many factors, including
• Different compiler optimizations
• Statement ordering
• Run-time libraries
For example, a function call such as
sin(2.0) might return a slightly
different value, depending on which C library you are using.
For the same reasons, your comparison results might not be identical to those
above.