制御工学

【MATLAB & SIMULINK】How to Change Sample Time or Sampling Time

reference : MATLAB icon by Icons8

Today, I’d like to teach you how to change a sample time.

Have you ever experienced that the output value was supposed to follow the reference, but it didn’t follow it? The cause is sample time.

As you can see from the chart below, the output value is vibrating around the reference. However, this output value is also supposed to follow the reference.
Then, let’s learn how to change a sample time, using the chart below.

Click the Scope.

Please click your “scope” in Simulink.

Select the Configuration properties.

Next, select “configuration properties”.

Set the Sample Time.

Third, you can see “sample time”, and probably it is set at -1 by default settings. Then, let’s change from -1 to an arbitrary value.
When you entered 1, it means your sample time is 1 second. When you entered 100, it means your sample time is 100 seconds.
After that, select “apply” and “OK”.

Don’t forget to click the Run.

Finally, don’t forget to click “Run”. Without clicking it, the scope screen doesn’t change at all.

If you follow the steps above, your sample time will change as the chart below.