How using function Stairs for a market ?

 Accepted Answer

dpb
dpb on 3 Apr 2018
Edited: dpb on 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:

More Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Asked:

on 3 Apr 2018

Commented:

dpb
on 4 Apr 2018

Community Treasure Hunt

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

Start Hunting!