![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1669076/image.png)
Ramp block having reset option
3 次查看(过去 30 天)
显示 更早的评论
I would like to implement in simscape a kind of ramp block having reset option, thus that ramp would start rising from zero every time the reset is triggered. I've tried with resetable subsystem block but is of no helpfull.
Have u got any idea how to solve this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1669001/image.jpeg)
0 个评论
回答(2 个)
Aquatris
2024-4-15
Here is one way with enabled subsystem, where the subsystem comes up with an offset (so if the ramp number gets too large it might be a problem):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1669076/image.png)
5 个评论
Aquatris
2024-5-8
There is no right or wrong as long as the output signal is what you expect, or unless it is a homework question asking to use a specific method.
In discrete time, there is no real ramp, it is always a step.
The ramp block does not have a reset option, so I introduced another method to generate 'resetable ramp' with an integrator.
I showed the output of the resettable subsystem as saw so why do you thinkg integral approach cannot genereate saw? The output of an integral gives a ramp, and with the reset functionality it becomes a saw
Sam Chak
2024-4-16
Hi @Andraz
If you have a good understanding of the fundamental mathematics behind a line graph, then theoretically, you should be able to implement the mathematical formula for a Resettable Ramp in the MATLAB Function block. This way, you can avoid using any specialized blocks that require a more abstract programmatic If–Else logic to comprehend.
t = linspace(0, 10, 1001);
p = 2*(heaviside(t - 2) + heaviside(t - 4) + heaviside(t - 6) + heaviside(t - 8));
y = (t - p)/2;
plot(t, y), grid on, ylim([-0.5, 1.5])
xlabel t, ylabel y(t), title('Resettable Ramp')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!