How to generate a signal with time delay?

조회 수: 5 (최근 30일)
Juan Nunez
Juan Nunez 2018년 12월 7일
댓글: madhan ravi 2018년 12월 8일
Hello guys,
I'm creating a model in Simulink in which I have a sinusoidal input and I need to generate an output signal like the following:
100 if the signal is positive
zero when the value of the signal is whithin the range [-0.1,0.1]. This output value must be kept during 1 second regarless the value of the input.
-100 if the signal is negative.
I'm not sure if it's better to use delay blocks or a matlab function.
Any ideas??
Thanks.
  댓글 수: 2
Basavalingappa Mudhol
Basavalingappa Mudhol 2018년 12월 7일
Let me know if its this behaviour you expected i can give solution for this
behavour.PNG
Juan Nunez
Juan Nunez 2018년 12월 7일
Thank you for your answer. Yes it's exactly what I require.

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

채택된 답변

Basavalingappa Mudhol
Basavalingappa Mudhol 2018년 12월 7일
Basically There are three parts in my model
1(in picture) this logics checks your base condition like if the input lies in which range >0.1 or <0.1 based on this either 100 or -100 is set
And the tricky part. if its in the range of 0.1 to -0.1 hold it for 1 sec. this is done by part 2 and 3(in Picture).
Here in part 2 is for the timer of 1 second. once your input is wihin range it triggers a counter until 1 sec.
and part 3( in picture). this is to latch he output to 0 for 1 second. after 1 second the counter is reset and it rechecks for the input.
I am bad at explaining may be this gives you a basic idea.
Please comment if you have questions. and vote and accept the answer if it solves your question.
I just tried to do a quick modelling . So this can be optimised even further if its just for simulation or you need to for code generation
thanks. :) Nice problemsolution.PNG
  댓글 수: 2
Juan Nunez
Juan Nunez 2018년 12월 8일
I'm sorry for the late reply. I built the model using your suggestion and it worked without any problem. Again thank you for your answer.
madhan ravi
madhan ravi 2018년 12월 8일
@Juan if it worked make sure to accept the answer

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by