필터 지우기
필터 지우기

How to initialize the size of a Simulink vector with a constant block

조회 수: 20 (최근 30일)
Jay Land
Jay Land 2013년 4월 8일
I have a nx1 length rand vector being used in a Simulink model. I would like to be able to change its length, n using a constant block. I am new to Simulink so this is probably a pretty basic question but I can't get it to work. I can create the vector as a constant with rand(10,1) for example or I can set N=10 in the Matlab workspace and use rand(N,1) as the constant but I want to be able to change N on the block diagram.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2013년 4월 22일
If 'N' changes during simulation, it essentially means that the size of the signal (Nx1) changes during simulation. These types of signals are called Variable-size signals in Simulink and must be bounded (ie. you need to specify an upper bound for N). I can't think of an existing block that lets you output a variable-size signal with values rand(N,1), but you can easily implement such a block using a MATLAB Function block. Please also remember to configure the block to output a variable-size signal.

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by