Simple Question on Simulink to generate an array of values

2 Ansichten (letzte 30 Tage)
Ash1992
Ash1992 am 1 Mär. 2017
Kommentiert: Sam McDonald am 8 Mär. 2017
Hello Everyone ,
I feel that its really a dumb question to be even posted on forums. but i couldn't figure out the solution for simple problem which i am facing.
The Problem is I need to generate an array of values say [1:20] (or) [1:45] (or) [1:n] (or) even zeros(1,n) ,so this n varies for every time step (using discrete mode simulation)...
How would I get these values on simulink ???
  1 Kommentar
Sam McDonald
Sam McDonald am 8 Mär. 2017
Do you mean the array varies in size for each time step? If so, what are you trying to do?
If you are simply wanting to generate an array of values that stays constant for each time step, then you can use a Constant block.
From the documentation page for the Constant block:
The Constant block generates a real or complex constant value.
The block generates scalar, vector, or matrix output, depending on:
  • The dimensionality of the Constant value parameter
  • The setting of the Interpret vector parameters as 1-D parameter
The output of the block has the same dimensions and elements as the Constant value parameter. If you specify for this parameter a vector that you want the block to interpret as a vector, select the Interpret vector parameters as 1-D parameter. Otherwise, if you specify a vector for the Constant value parameter, the block treats that vector as a matrix.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by