Turn off a Signal for a few seconds and then turning it back on

조회 수: 5 (최근 30일)
Daniel Senst
Daniel Senst 2020년 2월 11일
댓글: Daniel Senst 2020년 2월 12일
Hi,
I'd like to turn off a signal for about 5 Seconds after it will be used again (It can differ from 0 to 5, depends on the Input the Signal gets). Hence I need a periodic function to turn it off and after 5 Seconds back on. Is that doable in Matlab/Simulink? Or rather, how can I do it?
Thanks
  댓글 수: 2
stozaki
stozaki 2020년 2월 11일
Can you use Stateflow?
Daniel Senst
Daniel Senst 2020년 2월 11일
Yes, I can use stateflow. I just tried it and came to the conclusion that I, most likely, will have to do a fourier transformation. Or is there another possibility to do that?
My clue was to use a sine wave as input for the stateflow chart and when it is positive (>0), there shall be an 1 passing through. If it is negative, there will be a 0. That now activates a switch which lets through the information of the Signal for just a second and then closes for 9 seconds

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

채택된 답변

stozaki
stozaki 2020년 2월 11일
I attached example model. But it is created by R2019a and backport to R2013b.
  댓글 수: 5
stozaki
stozaki 2020년 2월 12일
"c" means context. Using "c" means data type casting.
Daniel Senst
Daniel Senst 2020년 2월 12일
Well, I spotted something which will now be going deeper into what I wanted to do with that ^^
I am building a Robotic Arm with Lego Mindstorms which sorts colors. The Systems you wrote do work perfectly fine, but only after a certain case. Basically the Arm is in a defaukt position from which he picks up a brick. That brick is the signal (the real signal is it's color that's been recognised by a sensor) and once it got grabbed by the arm the signal fades and would trigger the default position. Thats why I needed your system.
The procedure after recognising the color is: Arm goes down, grabs the block, goes back up, turns 180°, goes down, opens claw and goes back to default.
Now the problem: I can only take away the brick when the arm turns 180°. When I take it away before it will come back to default position and doesn't go through the rest of procedure which grinds my gears right now.
So there was nothing wrong with your code. I guess I have to do something different inside of my code

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 LEGO MINDSTORMS EV3 Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by