Can't find sat() function

56 views (last 30 days)
Jennie Leong
Jennie Leong on 17 Dec 2021
Commented: Walter Roberson on 18 Dec 2021
Hi, I want to use sat function (which is a saturation function) but I not sure which toolbox contains this function. Can anyone help? :) Urgent question!!!
  2 Comments
Jennie Leong
Jennie Leong on 18 Dec 2021
Sorry about that and thanks for answering to my question :)

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 17 Dec 2021
which sat -all
'sat' not found.
sat.m is not found in any MathWorks provided toolbox.
You may need to ask your instructor, since they may have written this code. Another possibility is that function may be found on the file exchange. So I looked there. (You could have done as easily!)
When I did so, after a looking at dozens of tools, I found this:
which does have a function named sat.m
function y=sat(x);
% sat is the saturation function with unit limits and unit slope.
if x>1
y=1;
elseif x<-1
y=-1;
else
y=x;
end
which does something with a saturation. Is that what you want? God only knows. :) well, you may know. Anyway, that function sat is actually pretty simple.
  1 Comment
Walter Roberson
Walter Roberson on 18 Dec 2021
function y = sat(x)
%vectorized version
y = max(-1, min(1, x));
end

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by