How to design a customized sample based signal in Simulink?
1 view (last 30 days)
Show older comments
venkat on 2 Jun 2014
Answered: luciana lima on 7 Aug 2015
I am trying to design a source block in simulink, that takes sample count and data values as inputs and generates a signal corresponding to number of samples and data values for samples specified.
for example, user enters sample count and data value in the mask parameter of the block as [4 5.2;6 3.2]. The block should generate value 5.2 for the duration 4*sample time and value 3.2 for the duration 6*sample time.
sample time is the simulink model sample time set in configuration parameters.
Sebastian Castro on 5 Jun 2014
You can do this by creating a custom block mask around the existing Repeating Sequence Stair block.
I've modified your suggested approach a little bit so you have 2 separate vectors for the number of samples and the actual data values. After creating the mask, you can get something like this:
Inside the block, I just have a Repeating Sequence Stair block that uses the specified sample time (Ts) and some other vector named val. This vector is defined in the Mask Initialization Commands.
The Scope output is shown below.
More Answers (1)
luciana lima on 7 Aug 2015
Hi Castro How can I do change frequency when I use source the block repeating sequence stair? Follows my model. Thank you
Find more on Signal Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!