Make a signal that changes over time from a simulink block

1 view (last 30 days)
I am using a MAtLAB function inside simulink to program a DSP. The function is running based on a sample time 0.2 ms. At each sample time, I want to output a matrix of values with the sampling time of 1 us. So I want the output to be a matrix of 1*200. I dont know how to make this matrix in a way that the PWM block receives subsequent elements in each 1 us.

Answers (1)

Sai Sri Pathuri
Sai Sri Pathuri on 7 Aug 2019
If the output matrix of function is input dependent, you may not produce a matrix with sampling time of 1 us, since the MATLAB function block produces, and updates output at every 0.2 ms.
If the matrix is input independent, you may use for loop that runs 200 times inside the MATLAB function block and update the matrix at each iteration. Even here the output matrix is updated at 0.2 ms only.
If you want to send data to PWM block at each 1 us, you may change the sampling time of function block to 1 us and instead of inserting value into the matrix, send the value directly to the PWM block.

Community Treasure Hunt

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

Start Hunting!