Ramp up/down function based on the variable input in Simulink/Matlab

Hi,
I am kind of new to Simulink and I am having trouble trying to generate an output signal (as attached) which will be ramped up and down to a certain setpoint depending on the input signal. I have tried using the ramp up function with min block but so far this combination could not generate the desired output. The output stops ramping up after it reaches to the first setpoint.
Any suggestions? Your help is really appreciated.

7 Comments

I am not quite sure what you are looking for. Do you want to create this custom signal in simulink? Maybe you can use the Signal builder/Signal Editor block.
Hi, I am not simply trying to build the signal. I am trying to create a function which can generate such output. For example, if I want my output to be 850 (initially zero), the function should yield the output in a ramping up manner, not changing the output instantly. The same goes when I need the output to be lower than the current value, the function should yield the output in a ramping down manner. So, the signal of this function block should look like the graph which I attached.
In that case you should use the 'Rate Limiter' block. See this simple example:
Capture.JPG
This will give you output like this:
Capture.JPG
Where blue is your input and yellow is output. So instead you get "output in a ramping up manner, not changing the output instantly". This holds good for ramp down also. You can change the settings of the rate limiter block to get the desired output slope. Hope this helps!
Hi Raj,
This helps. Btw, is there anyway to set the upperlimit and the lowelimit of the output?
Thank you!
Well you can set the final value in your 'Step' block or you can use a saturation block to limit the output within predefined boundaries.
Hi Raj,
Thank you very much for your suggestion.
Hi Aung Myat,
I am developing the same program and I have many problems. How could you solve it?

Sign in to comment.

Answers (1)

Hello Aung,
For your use case, the simplest way to generate the specified signal is by utilizing the "Signal Editor" block.
Yes, the above can be achieved by using "Ramp" and "Saturation" blocks but if you know the points at which the signal is changing, it could be easily built with "Signal Editor" block. Here is the link to the documentation of the same:
For the given use case, you can follow these steps to generate the signal:
  • Add a "Signal Editor" block in simulink and open it's dialog box.
  • Click on "open signal editor" icon. A new window will appear.
  • On the left side, click on "scenerio" and select "signal 1".
  • Add the points and their assoicated values on the right side.
  • Make sure to set interpolation to "linear". Once done save the signal in a MAT file.
  • The above MAT file will be used by the "Signal Editor" block. Check the "Interpolate data" checkbox in the dialog box to get the ramp signal.
Hope it helps.

Tags

Asked:

on 27 Dec 2019

Answered:

on 30 Oct 2024

Community Treasure Hunt

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

Start Hunting!