When modeling dynamic systems, it is often necessary to control the initialization and reset characteristics of signals and states. This model shows how this can be done using the initial value property of signal objects.
Open the example model
In this model, the following signals and states are configured using signal objects:
Root input signal (
Discrete states initial condition (
Conditionally executed subsystem output port initial output (
Other persistent signals (
The initial values of signal objects
S2 are specified using tunable parameters
Simulate the model and inspect the results in the scope display.
Generate code by double-clicking a blue button. Inspect the generated code.
Change the initial value of
S2 (or the tunable parameters
aa2) in the Model Explorer and redo the simulation and code generation to inspect the results.