Problem with incremental time step.

I have modelled a DAC using Simulink and Matlab. As an input I am using a sine wave with variable frequencies but with sample times set at 1ps(1e-12). Now, for one simulation the run time was 200 ns which means that the time signal at the output should have 200000 (actually 200001 because 0 is included) discrete data points (200ns/1ps). However, the output signal matrix (1-Dimensional Column vector) shows 200065 elements. While checking the column entries (time signal values) in the matrix at row-2085, I observed that the incremental time step from previous data entry(row 2084)was not 1ps (sample time given at the input) but something like 0.3ps .The values were 2083(row 2084) and 2083.3ps(row 2085, when it should have been 2084ps). This means that an additional data point is introduced . While checking further throughh the matrix, I found this happened again at row-4169 (I am not sure though, if this happens after every 2084 rows) but surely 64 additional data points have crept in (200065-200001). Is this a bug with Simulink or there is a defenite explanation for this? If there is please get back with the solution as soon as possible.
regards,
Sharjeel.

 Accepted Answer

Titus Edelhofer
Titus Edelhofer on 7 Jul 2011
Hi Sharjeel,
it depends on the solver you use: if you use a fixed step solver, this should not happen. But if you use a variable step solver, the solver is "allowed" to make steps as he likes (including of course the "given" steps from your input). Take a look at the Configuration Parameters menu-> Solver Tab and select a fixed step solver and set stepsize to 1ps.
Titus

1 Comment

Hi Titus,
That suggestion was right on target. Issue resolved.
Thanks a lot.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!