How to create a graph without knowing the data points?

조회 수: 2 (최근 30일)
Pieter Cecat
Pieter Cecat 2017년 3월 26일
댓글: Star Strider 2017년 3월 26일
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!

채택된 답변

Star Strider
Star Strider 2017년 3월 26일
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
Pieter Cecat
Pieter Cecat 2017년 3월 26일
I have replicated your graph. Thank you for that! I am not sure whether or not it is exponential which is why I did not explicitly mention it.
Best regards Pieter
Star Strider
Star Strider 2017년 3월 26일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by