Simulink Ramp - On Demand
Show older comments
Hello,
I would like to have a signal ramp from a min. value to a max value. and back down again, in a set amount of time. I initially did this with persistent variables which allowed me to reset the ramp signal and run it essentially on demand. Is there a simple work around that doesn't involve the use of persistent variables?
On a related note, is it possible to output the sample time as a variable? I've tried using a clock with a memory block, and subtracting to get the sample time, but for a fixed step size of 0.0001, the sample time is not constant but varies between 0.0009999 and 0.0001.
Thanks
4 Comments
There are a few things that are unclear to me in your question.
1) What do you mean by "persistent variables" in Simulink?
2) Are you sure that you have the right number of zeros in your time step numbers, or could it be 0.0000999 and 0.0001. These would be essentially the same value in digital representation (variation only in the least significan bit). If you set the model time ste to a fixed size, it should not vary, but computing the step by taking the difference between two numbers may have some "noise" in the LSB.
Julian Pires
on 31 Jan 2019
Abdur
on 29 Nov 2025
There are a few things that are unclear to me in your question. 1) What do you mean by "persistent variables" in Simulink? 2) Are you sure that you have the right number of zeros in your time step numbers, or could it be 0.0000999 and 0.0001. These would be essentially the same value in digital representation (variation only in the least significan bit). If you set the model time ste to a fixed size, it should not vary, but computing the step by taking the difference between two numbers may have some "noise" in the LSB.
Abdur
on 29 Nov 2025
Good
Accepted Answer
More Answers (0)
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!