How using function Stairs for a market ?

 Risposta accettata

dpb
dpb il 3 Apr 2018
Modificato: dpb il 3 Apr 2018
S = [400 500 200]; % supply
PS = [15 25 55]; % Price supply
[PS,iPS]=sort(PS); % sort price ascending; keep in order with supply
S=S(iPS); % rearrange supply with sorted price
[PD,iPD]=sort(PD,'descend');
D=D(iPD);
figure
stairs([0 cumsum(S)],[PS PS(end)])
ylim([0 70])
hold on
stairs([0 cumsum(D)],[PD PD(end)],'r-')
yields:

Più risposte (0)

Categorie

Scopri di più su Financial Toolbox in Centro assistenza e File Exchange

Richiesto:

il 3 Apr 2018

Commentato:

dpb
il 4 Apr 2018

Community Treasure Hunt

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

Start Hunting!

Translated by