I am inexperienced in using Matlab and am trying to plot a graph. The function and what it should look like can be found in the pictures attached.
Difference with the graph attached is that the curve should be mirrored. In other words, for q = 0, c(q) should be Alpha1 and for q = 1, c(q) should be Alpha0.
My attempts so far have not been very successful. Any help would thus be appreciated! Thank you in advance!
I'm using Matlab 9-1

댓글 수: 2

kowshik Thopalli
kowshik Thopalli 2017년 3월 20일
편집: kowshik Thopalli 2017년 3월 20일
use hold on and hold off commands.
help hold
Pieter Cecat
Pieter Cecat 2017년 3월 20일
Unfortunately I did not create the graph attached so any help would be welcome, where the graph is mirrored right away. Thank you very much!!

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

 채택된 답변

Star Strider
Star Strider 2017년 3월 20일

0 개 추천

‘In other words, for q = 0, c(q) should be Alpha1 and for q = 1, c(q) should be Alpha0.’
That is not the way the formula for c(q) is written. For q=0, c(q) should be a0, and it is, and for q=1, c(q) should be a1, and it is.
The Code
q = linspace(0, 1);
a0 = 60;
a1 = 25;
c = @(q,b) a0 + (a1 - a0).*(q.^b);
b = [1/3 1 3];
[Q,B] = meshgrid(q,b);
figure(1)
plot(q, c(Q,B))

댓글 수: 4

Pieter Cecat
Pieter Cecat 2017년 3월 20일
Thank you very much! I was wondering if it is possible to add labels to my graphs (beta for each line) as well as to name my axes.
Thanks a lot! I appreciate your help!
My pleasure!
The code changes slightly to accommodate the labels for the curves.
The Code
q = linspace(0, 1);
a0 = 60;
a1 = 25;
c = @(q,b) a0 + (a1 - a0).*(q.^b);
b = [1/3 1 3];
[Q,B] = meshgrid(q,b);
cq = c(Q,B);
CL = cq(:,40);
figure(1)
plot(q, cq)
xlabel('\itq\rm')
ylabel('\itc(q)\rm')
text([1 1 1]*0.4, CL, {'\beta = 1/3','\beta = 1','\beta = 3'}, 'HorizontalAlignment','right', 'VerticalAlignment','top')
Pieter Cecat
Pieter Cecat 2017년 3월 26일
Hi I have another question and was hoping you could help me out again.
I am trying to create the following graph in Matlab (see attached) but can't seem to make it work as I have no data points 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!
This is as close as I can get:
x = linspace(0,100);
y = 1./(100 - x);
figure(1)
plot(x, y)
set(gca, 'XLim',[80 100])
xlabel('Service Level (%)')
ylabel('Safety Stock Requirements')

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2017년 3월 20일

댓글:

2017년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by