Sample Time

 

Sample Time is a scalar interval between samples. In case of the discrete system, the sample time is same to sampling rate at in a discrete system.

     If a block sample time of a block is set to -1, the sample time is inherited.

     If all of block sample times in a model are set to -1, the sample time is used to the value defined in the Simulation Parameter dialog box.

     If some of block sample times in a model are set to the different values, the model uses a variable-step solver.

     If the inputs have different sample times and the block sample time is set to -1, the sample time is used to the value for the greatest common integer divisor(GCD) of the sample times coming into the block.

 

Example

Figure 1  A example mode for Sample Time

 

1.  'Sum' block is a continuous system as the sample time is set to 0. So, the block can get a value at a time when required. While the simple time of 'Sine' block connected to 'Sum' block is set to 0, the sample time of 'Step' block is set to 0.1. In other words, 'Sum' block calculates outputs every 0.1s.

2.  'Gain' block is set to 0.2.  It has different sample times as the inputs of 'Gain' block are outputs of 'Sum' block.

3.  'Gain1' block is set to 0.5. It has different sample times as the inputs of 'Gain1' block are outputs of 'Sum' block.

4.  'Sum1' block is inherited as the sample time is set to -1. Here a problem occurs since inputs have different sample times. In that case, the sample time is used the value for the greatest common integer divisor (GCD) of the sample times coming into the block. In other words, 'Sum1' block has 0.1s sample time as GCD of 0.2 and 0.5 is 0.1.