필터 지우기
필터 지우기

plot area with different collar.

조회 수: 3 (최근 30일)
Mahmood
Mahmood 2023년 10월 27일
댓글: Voss 2023년 11월 6일
how plot graph like this.

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 10월 27일
This exercise can be done with plot() and patch() and/or fill() fcns.
(1) Determine the values of VOLL, Lambda, DI_at, d_at, D_at
(2) Determine the equation/data of the parabola curve
(3) Use plot()
(4) Use patch() or fill()
See these examples: Example1, Example2 , Example3 , Example4
All the best.

Voss
Voss 2023년 10월 27일
VOLL = 1;
lat = 0.82;
DatI = 0.9;
dat = 1;
Dat = (-lat*DatI+VOLL*dat)/(VOLL-lat);
xmax = Dat*1.15;
ymax = VOLL*1.1;
figure()
ax = gca();
line( ...
'Parent',ax, ...
'XData',[0,DatI,Dat], ...
'YData',[VOLL,VOLL,0], ...
'Color','b', ...
'LineStyle','-', ...
'LineWidth',1.5)
line( ...
'Parent',ax, ...
'XData',[dat,dat,0], ...
'YData',[0,lat,lat], ...
'Color',[0.75,0.75,0.75], ...
'LineStyle','-.')
x = linspace(0,dat);
y = (exp(x/dat*2.6)-1)/(exp(2.6)-1)*0.75*lat;
patch( ...
'Parent',ax, ...
'XData',[x,dat,0,0], ...
'YData',[y,lat,lat,0], ...
'FaceColor',[204,204,255]/255, ...
'EdgeColor','none', ...
'FaceAlpha',0.6)
patch( ...
'Parent',ax, ...
'XData',[0,dat,DatI,0], ...
'YData',[lat,lat,VOLL,VOLL], ...
'FaceColor',[204,255,204]/255, ...
'EdgeColor','none', ...
'FaceAlpha',0.6)
line( ...
'Parent',ax, ...
'XData',[x,dat], ...
'YData',[y,VOLL], ...
'Color',[0,0,0], ...
'LineStyle','--')
x = dat*0.3+Dat*0.7+[0,0.05];
y = VOLL-(x-DatI)/(Dat-DatI);
line( ...
'Parent',ax, ...
'XData',x([1 2 2]), ...
'YData',y([1 1 2]), ...
'Color',[0,0,0], ...
'LineStyle','-')
text( ...
'Parent',ax, ...
'Position',[x(2),mean(y)], ...
'String','\it E', ...
'Interpreter','tex')
patch( ...
'Parent',ax, ...
'XData',xmax*[1,0.9825,0.9825], ...
'YData',ymax*[0,0.01,-0.01], ...
'FaceColor',[0,0,0], ...
'Clipping','off')
text( ...
'Parent',ax, ...
'Position',[0,ymax], ...
'String','Price', ...
'Interpreter','tex', ...
'HorizontalAlignment','right', ...
'VerticalAlignment','bottom')
patch( ...
'Parent',ax, ...
'XData',xmax*[0,0.01,-0.01], ...
'YData',ymax*[1,0.9825,0.9825], ...
'FaceColor',[0,0,0], ...
'Clipping','off')
text( ...
'Parent',ax, ...
'Position',[xmax,0], ...
'String','Demand', ...
'Interpreter','tex', ...
'HorizontalAlignment','center', ...
'VerticalAlignment','top')
ax.TickDir = 'both';
ax.Layer = 'top';
ax.Box = 'off';
ax.XAxis.TickLabelInterpreter = 'tex';
ax.YAxis.TickLabelInterpreter = 'tex';
ax.XTick = [0, DatI, dat, Dat];
ax.XTickLabels = strcat({'\it '},{'', 'D_{at}^I', 'd_{at}', 'D_{at}'});
ax.XLim = [0 xmax];
ax.YTick = [0, lat, VOLL];
ax.YTickLabels = strcat({'\it '},{'', '\lambda_{at}', 'VOLL'});
ax.YLim = [0 ymax];
  댓글 수: 4
Mahmood
Mahmood 2023년 11월 6일
thanks a lot and how should i put titels for those different areas ?
Voss
Voss 2023년 11월 6일
Maybe use text() obejcts or legend().

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by