Explore Measurable and Tunable Model Elements
Open the model CapiSigsParams
.
capiMdl = "CapiSigsParams";
open_system(capiMdl);
Simulate Model
The Sine Wave block generates a signal, which is branched. Each of the two Gain blocks amplifies one of the branches. The output of the Gain blocks are measurable signals. During model simulation, the Scope block displays these two signals.
Simulation the model and see how the scope plots the two amplified signals.
sim(capiMdl)
Change Gain Values
The gain coefficients are specified as the model parameters Amp_coef_1
and Amp_coef_2
. These can be tuned to change the amplitude of the amplified signals.
Use the Model Explorer to change the gain coefficient values to 3
and -4
(see Edit and Manage Workspace Variables by Using Model Explorer).
Alternatively, you can change the gain coefficient values programmatically by entering these commands in the Command Window:
workSpace = get_param(capiMdl,"ModelWorkspace"); workSpace.getVariable("Amp_coef_1").Value = 3; workSpace.getVariable("Amp_coef_2").Value = -4;
Simulate the model again and observe how the amplitudes of the amplified signals change after modifying the gain coefficient values.
sim(capiMdl)
In the next step of the example, you configure the model to include the C API elements for signals and parameters in the generated model code. To continue to the next step of the example, use this in the Command Window:
openExample("simulinkcoder/CapiSigsParams02Example")