Azzera filtri
Azzera filtri

variable discrete vector generation in Simulink

1 visualizzazione (ultimi 30 giorni)
Mojtaba
Mojtaba il 11 Set 2012
I need to make sequence (1D vector) from 2 constants in Simulink.
e.g.: x1=1 and x2=10 as input constant
Desired vector: X=[1 2 3 4 5 6 7 8 9 10]
I know It is very easy to generate such vector in matlab, but I really want to do it in terms of blocks and not even Embedded Matlab Function Block.
Thanks in Advance
  14 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 12 Set 2012
Matlab function is supported by HDL coder. Depends on verision of matlab you are using
TAB
TAB il 13 Set 2012
Mojtaba, If you hints us about your requirement, may be anyone can suggest a better alternative solution.

Accedi per commentare.

Risposte (2)

Kaustubha Govind
Kaustubha Govind il 12 Set 2012
Modificato: Kaustubha Govind il 12 Set 2012
Mojtaba: Do x1 and x2 change during simulation? If not, try defining them as workspace variables.
  • Constant block: Enter [x1:x2] as Value.
  • MATLAB Function block: Make them non-tunable parameters on the block's Ports and Data Manager and compute output using [x1:x2].
  2 Commenti
Mojtaba
Mojtaba il 12 Set 2012
yes they change during simulation.
Kaustubha Govind
Kaustubha Govind il 13 Set 2012
I think this is a lot harder to do. You will need to understand Variable-Size Signals because if x1 and x2 change during simulation, the size of the signal also changes. I don't see any easy way to do this without the MATLAB Function block, but even with that block, I think this will be tricky.

Accedi per commentare.


Azzi Abdelmalek
Azzi Abdelmalek il 12 Set 2012
Modificato: Azzi Abdelmalek il 12 Set 2012
check the blocks supported by HDL coder at http://www.mathworks.com/help/hdlcoder/ug/summary-of-block-implementations.html at the end of the page(simulink/User-Defined Functions/MATLAB Function)
MATLAB Function (was Embedded function for previous versions)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by