How to create a graph without knowing the data points?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Pieter Cecat
el 26 de Mzo. de 2017
Comentada: Star Strider
el 26 de Mzo. de 2017
Hi
I am trying to create the following graph (exponential when service level goes to 100%) in Matlab (see attached) but can't seem to make it work as I have no data points (function) given.
Note: 'safety stock requirements' is the label of the y-axis.
How can I do this?
Thanks a lot in advance! I really appreciate it!
0 comentarios
Respuesta aceptada
Star Strider
el 26 de Mzo. de 2017
I am not certain what the exponential function parameters would be (and you had not previously mentioned that it was exponential), so I presented a hyperbola that appeared to match the appearance of the plot in my Comment to your previous Question.
2 comentarios
Star Strider
el 26 de Mzo. de 2017
My pleasure!
It appeared more hyperbolic than exponential to me. I experimented with an exponential function and could not replicate your plot with what I considered to be sufficient accuracy.
This does a much better approximation. Choose the value of ‘n’ that works best for you.
The Code —
x = linspace(0, 100, 250);
n = 75;
y = 10^(2*n)./(10^(2*n) - (x+1).^n);
y(y < 1) = NaN;
figure(1)
plot(x, y)
set(gca, 'YLim',[0 5])
It scales and translates automatically so you only need to experiment with various values of ‘n’. The NaN assignments prevent ‘y’-values less than the set minimum from plotting.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!