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

5 vues (au cours des 30 derniers jours)
Daniel Senst
Daniel Senst le 11 Fév 2020
Commenté : Daniel Senst le 12 Fév 2020
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 commentaires
stozaki
stozaki le 11 Fév 2020
Can you use Stateflow?
Daniel Senst
Daniel Senst le 11 Fév 2020
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

Connectez-vous pour commenter.

Réponse acceptée

stozaki
stozaki le 11 Fév 2020
I attached example model. But it is created by R2019a and backport to R2013b.
  5 commentaires
stozaki
stozaki le 12 Fév 2020
"c" means context. Using "c" means data type casting.
Daniel Senst
Daniel Senst le 12 Fév 2020
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur LEGO MINDSTORMS EV3 Hardware dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by