MATLAB Answers

Payam
0

Saturation function in Simulink

Asked by Payam
on 14 Jul 2017
Latest activity Answered by Endrias
on 21 Jan 2019
Hi, I would like to implement following block in simulink. How do I do it in Simulink: U = u_d - K/b * sat(σ /θ)
where: sat(σ/θ) = {1 if σ>θ, σ/θ if −θ ≤ σ ≤ θ, −1, σ < −θ}
u_d is input, K and b are constant. If possible even a matlab function would be appritiated.

  0 Comments

Sign in to comment.

2 Answers

回答者: Sruthi Geetha 2017 年 7 月 17 日

In Simulink, you can implement this using If block and If action subsystem block. In the If block you can specify the number of inputs, If, elseif and else conditions. Connect three If action subsystems to each condition and generate the outputs as 1, sigma/theta and -1 for each of the conditions. You can also do this using a simple code in MATLAB Fcn block:
if sigma>theta
out = 1;
elseif (sigma>=-theta)&&(sigma<=theta)
out = sigma/theta;
else
out = -1;
end

  3 Comments

Payam
on 1 Aug 2017
I was more interested in doing it using simulink block without using any matlab functions
Leigh Boyd 2017 年 8 月 11 日
did you ever get an answer to this? I have a similar problrm
Payam
on 27 Aug 2017
I did it manually in a matlab function. not by using any blocks.

Sign in to comment.


回答者: Endrias
2019 年 1 月 21 日

Simulink have a nice IF expression block which you can program the sat(.) function without any matlab written code. If anybody interested to see the block code, let me know.

  0 Comments

Sign in to comment.