Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

different sample times of vectors

4 views (last 30 days)
Owen
Owen on 22 Nov 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 23 Nov 2012
Can you post your simulink model?
Owen
Owen on 25 Nov 2012
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

Answers (0)

This question is closed.

Products

Community Treasure Hunt

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

Start Hunting!