Saturating Functions at a certain value

28 visualizaciones (últimos 30 días)
Momen Elhassan
Momen Elhassan el 22 de Mayo de 2020
Comentada: Walter Roberson el 22 de Mayo de 2020
How do you saturate a function at a certain value on matlab? say for example I have the array x=[0:0.01:20] and the function expo=2.^x, and I want to plot the function expo with respect to x but I want the values to saturate when it reaches 1000 and remain equal to 1000 until the end of the array, looked up a bunch of stuff but all of it was useless.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 22 de Mayo de 2020
x=[0:0.01:20];
expo=@(x) min(2.^x,100);
plot(x,expo(x));
  4 comentarios
Momen Elhassan
Momen Elhassan el 22 de Mayo de 2020
thanks
Walter Roberson
Walter Roberson el 22 de Mayo de 2020
max(lower_limit, min(YourArray, upper_limit))

Iniciar sesión para comentar.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by