필터 지우기
필터 지우기

How to design a customized sample based signal in Simulink?

조회 수: 2 (최근 30일)
venkat
venkat 2014년 6월 2일
답변: luciana lima 2015년 8월 7일
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
Sebastian Castro 2014년 6월 5일
Hi Venkat,
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.
  댓글 수: 1
venkat
venkat 2014년 6월 9일
Thank you very much Castro.
That is helpful. I was looking to do the same using basic blocks of simulink. Repeating Sequence block repeats the signal periodically, but in my case i want it to stay at the last sample data value. I did the same using clock and some enabled subsystems to get the same comparing the simulation time and output the corresponding data value.
Thank you very much for taking the pain in replying my query ( a very lucid answer). It helped me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

luciana lima
luciana lima 2015년 8월 7일
Hi Castro How can I do change frequency when I use source the block repeating sequence stair? Follows my model. Thank you

카테고리

Help CenterFile Exchange에서 Signal Import and Export에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by