Info

此问题已关闭。 请重新打开它进行编辑或回答。

different sample times of vectors

1 次查看(过去 30 天)
Owen
Owen 2012-11-22
关闭: MATLAB Answer Bot 2021-8-20
Hi,
A data stream with a constant sample time 'ts' shall be converted to vectors of 2 different lengths (2 and 4) with the Buffer block. Example:
Data stream = … 1 2 3 4 5 6 7 8 9 10 11 12 …
Vector1 = … [1 2], [7 8], …
Vector2 = … [3 4 5 6], [9 10 11 12], ...
These 2 vectors must be combined with a constant from the Constant block with the Matrix Concatenate block.
For vector1: constant = [100 100]
For vector2: constant = [200 200]
So the result shall be:
End vector1 = … [100 100 1 2], [100 100 7 8], …
End vector2 = … [200 200 3 4 5 6], [200 200 9 10 11 12], …
The transmitted sequence shall be: … end vector1, end vector2, end vector1, end vector2 …
The problem is, there are 2 different sample times after the Buffer block: 2*ts and 4*ts. It seems very difficult to synchronize with this constant.
I tried to set the sample time of the Constant block as 2*ts and 4*ts with an Embedded Matlab Function at different time points but it doesn’t work (the output is only with length of 2 or length of 4 but not mixed as expected).
Can anyone show me a way?
Thanks Senmeis
  2 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2012-11-23
Can you post your simulink model?
Owen
Owen 2012-11-25
I’m sorry but it's not allowed to copy something from the computer in which Matlab is installed.
I think maybe I should do the procession in S functions or Embedded Matlab Functions. Sometimes I feel Simulink is only suitable for easy tasks. But thank you anyway.
Senmeis

回答(0 个)

此问题已关闭。

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by