Effacer les filtres
Effacer les filtres

plot area with different collar.

3 vues (au cours des 30 derniers jours)
Mahmood
Mahmood le 27 Oct 2023
Commenté : Voss le 6 Nov 2023
how plot graph like this.

Réponses (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 27 Oct 2023
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 le 27 Oct 2023
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 commentaires
Mahmood
Mahmood le 6 Nov 2023
thanks a lot and how should i put titels for those different areas ?
Voss
Voss le 6 Nov 2023
Maybe use text() obejcts or legend().

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by