Arduino Uno /Simulink: Sample Time not updating with different values
Figure 1: Simulink Model Figure 2: Sample Time @ 0.01
I am using Simulink (R2024a). I am using a pendulum to try to purposely get a scope of aliasing with the signal coming from the Arduino Uno. When I input the SampleTime (0.01), the program outputs a sine wave as expected.
Figure 3: Sine Wave at Sample Time @ 0.01 & Stop Time @10.0
When I change the Stop Time to 30.0 sec and ensure the Simulation pacing is 1:1, it outputs a sine wave and runs the whole simulation.
Figure 4: Sine Wave Sample Time @ 0.01 & StopTime @ 30.0
However, when I change the Sample time to any other value, the program doesn’t work as intended. The simulation is done in 1 sec even though the Simulation Pacing is a 1:1 ratio. It does get some aliasing, but it looks very incomplete.
Figure 5: Incomplete Aliasing with Sample Time @ 1.0 & Stop Time @ 30.0
The end result is supposed to look like this.
Figure 6: Goal of Aliasing graph on older MATLAB release
The diagnostic viewer reports no errors.
I have alternated with using different hardware (arduino board vs computer) and they both do not run correctly. I have experimented with different Sample Times, Stop Times, and 3D Array/Timespace/2DArrays (To Workspace) with no change or success.
I am thinking it has something to do with the updated version vs the older version that this experiment was based on.Figure 1: Simulink Model Figure 2: Sample Time @ 0.01
I am using Simulink (R2024a). I am using a pendulum to try to purposely get a scope of aliasing with the signal coming from the Arduino Uno. When I input the SampleTime (0.01), the program outputs a sine wave as expected.
Figure 3: Sine Wave at Sample Time @ 0.01 & Stop Time @10.0
When I change the Stop Time to 30.0 sec and ensure the Simulation pacing is 1:1, it outputs a sine wave and runs the whole simulation.
Figure 4: Sine Wave Sample Time @ 0.01 & StopTime @ 30.0
However, when I change the Sample time to any other value, the program doesn’t work as intended. The simulation is done in 1 sec even though the Simulation Pacing is a 1:1 ratio. It does get some aliasing, but it looks very incomplete.
Figure 5: Incomplete Aliasing with Sample Time @ 1.0 & Stop Time @ 30.0
The end result is supposed to look like this.
Figure 6: Goal of Aliasing graph on older MATLAB release
The diagnostic viewer reports no errors.
I have alternated with using different hardware (arduino board vs computer) and they both do not run correctly. I have experimented with different Sample Times, Stop Times, and 3D Array/Timespace/2DArrays (To Workspace) with no change or success.
I am thinking it has something to do with the updated version vs the older version that this experiment was based on. Figure 1: Simulink Model Figure 2: Sample Time @ 0.01
I am using Simulink (R2024a). I am using a pendulum to try to purposely get a scope of aliasing with the signal coming from the Arduino Uno. When I input the SampleTime (0.01), the program outputs a sine wave as expected.
Figure 3: Sine Wave at Sample Time @ 0.01 & Stop Time @10.0
When I change the Stop Time to 30.0 sec and ensure the Simulation pacing is 1:1, it outputs a sine wave and runs the whole simulation.
Figure 4: Sine Wave Sample Time @ 0.01 & StopTime @ 30.0
However, when I change the Sample time to any other value, the program doesn’t work as intended. The simulation is done in 1 sec even though the Simulation Pacing is a 1:1 ratio. It does get some aliasing, but it looks very incomplete.
Figure 5: Incomplete Aliasing with Sample Time @ 1.0 & Stop Time @ 30.0
The end result is supposed to look like this.
Figure 6: Goal of Aliasing graph on older MATLAB release
The diagnostic viewer reports no errors.
I have alternated with using different hardware (arduino board vs computer) and they both do not run correctly. I have experimented with different Sample Times, Stop Times, and 3D Array/Timespace/2DArrays (To Workspace) with no change or success.
I am thinking it has something to do with the updated version vs the older version that this experiment was based on. matlab, simulink, arduino MATLAB Answers — New Questions