Make a signal that changes over time from a simulink block
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Sai Sri Pathuri
2019-8-7
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Array and Matrix Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!