MATLAB Answers

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

2 views (last 30 days)
Daniel Senst
Daniel Senst on 11 Feb 2020
Commented: Daniel Senst on 12 Feb 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 Comments

Daniel Senst
Daniel Senst on 11 Feb 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

Sign in to comment.

Accepted Answer

stozaki
stozaki on 11 Feb 2020
I attached example model. But it is created by R2019a and backport to R2013b.

  5 Comments

Show 2 older comments
Daniel Senst
Daniel Senst on 12 Feb 2020
Ok, when I plugged that Chart in into my code, it didn't know what that c stand for and complained about it, but when I started the Programm you wrote, everything was fine. Do I have to detemine that c or what is it?
Also, where did you think I should plug it in? I thought I had to replace it with the constant 1 which is in front of the relational operatior in your programm because it only has an output but I guess that wasn't right.
And it doesn't matter if it is the sample time count or absolute time, I can rescale that to the value I think fits the best
Daniel Senst
Daniel Senst on 12 Feb 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

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by