User`s guide
2 Getting Started with the Real-Time Workshop
2-26
Comparing Pilot_G_force to rt_Pilot_G_force produces:
max(abs(rt_Pilot_G_force-Pilot_G_force))
ans =
1.0e-012 *
0 0.1007
So overall agreement is within 10
-12
. This slight error is caused by many
factors, including:
• Different compiler optimizations
• Statement orderings
• Run-time libraries
For example,
sin(2.0) may differ depending on which C library you are using.
Analyzing Data with MATLAB
For a more detailed analysis, you can add To Workspace blocks to the Simulink
model. These blocks allow you to access any data generated within the block
diagram and save it in MATLAB workspace variables. Alternatively, you can
connect scope blocks configured to log data to the model.
Tracing Generated Code Back
to Your Simulink Diagram
When you generate code, the Real-Time Workshop creates tags throughout the
code that you can use to trace back to your Simulink model. In particular, the
Real-Time Workshop generates a header file, called
model.h, that documents
howtousethetagswiththeMATLAB
open_system command.
The basic format is
<system>/block_name,wheresystem is the system number
(uniquely assigned by Simulink) and
block_name is the name of the block.