Clear Filters
Clear Filters

How to prevent small variations in a signal in Simulink?

8 views (last 30 days)
I have a signal which have some variations in them, some small and some large. I want the signal to be modified in such a way that the signa is unaltered for small chnges but for large changes the new value of the signal should change accordingly.
Eg. [ 3 3.1 3.05 6 8 10] should be changed to [3 3 3 6 8 10]

Answers (1)

Shubham
Shubham on 27 Aug 2024
Edited: Shubham on 27 Aug 2024
Hey Xeke,
I understand that you wish to maintain the previous value of an input signal if it has a very minute change, otherwise you want to use the incoming signal value without any changes. You can achieve your goal in MATLAB by simply iterating over the signal and comparing it with the last value to check if it exceeds your defined threshold. For this purpose, you would first need to define a threshold value below which any changes to the signal are meant to be ignored.
However if you wish to do this in Simulink, you can use a MATLAB Function block. Alternatively you may create a subsystem that holds the previous output value of the input signal based on a condition. You may refer to this blog post to understand various ways to create a subsystem for holding the value of an input signal: https://blogs.mathworks.com/simulink/2014/08/06/how-do-you-hold-the-value-of-a-signal/
Once you have created the subsystem for holding the input signal, you would require another subsystem for generating the control signal. You can generate this signal by taking the difference of the input signal from the previous value (using a unit delay block) and comparing it with a threshold value. One possible way of constructing the subsytem could be:
You can then use this control signal along with the "Hold" subsystem previously created to prevent any minor changes in your signal.
I hope this helps!

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!