Can't find sat() function

170 visualizaciones (últimos 30 días)
Jennie Leong
Jennie Leong el 17 de Dic. de 2021
Comentada: Walter Roberson el 18 de Dic. de 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 comentarios
John D'Errico
John D'Errico el 17 de Dic. de 2021
Luckily, I had some free time, and your problem was easy to solve. But remember that we don't really care that your problem is urgent, and that every other person asking a question on Answers has just as much a right to hope for a timely answer to their questions as do you.
Finally, I would comment that the answer I did post was something you could have trivially found in far less time than it took you to write the question and for me to give you an answer.
Jennie Leong
Jennie Leong el 18 de Dic. de 2021
Sorry about that and thanks for answering to my question :)

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 17 de Dic. de 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 comentario
Walter Roberson
Walter Roberson el 18 de Dic. de 2021
function y = sat(x)
%vectorized version
y = max(-1, min(1, x));
end

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by