# aaaa xxx zzz AAA

524 views (last 30 days)
Joao Pereira on 26 Dec 2019
Edited: Joao Pereira on 18 Jan 2020
This question was flagged by Star Strider
add dd dd d d dd

Mark Sherstan on 26 Dec 2019
You were close! The x domain must be the same length and some of your variables were mislabeled. I quickly cleaned up your code and this should work for you:
x = 1:0.5:30;
y1 = -3*x +90;
y2 = 10+x;
y3 = -3*x +60;
plot(x,y1,'b', x,y2,'c', x,y3,'b')
ylim([0 100])
title ('Market Equilibrium')
xlabel('Quantitites')
ylabel('Price')
P12 = InterX([x;y1],[x;y2])'
P23 = InterX([x;y2],[x;y3])'
hold on
plot(P12(1,1),P12(1,2),'ro')
plot(P23(1,1),P23(1,2),'ko')
legend ('0G demand curve','OG supply curve','tax(30)','Intersection Y1-Y2', 'Intersection Y2-Y3')
hold off

Show 1 older comment
Image Analyst on 26 Dec 2019
InterX is YOUR code, not Mark's. Evidently you never had it so why did you write in a call to InterX if you don't even know what it is? Did you write the code? If not, ask the author to give you the InterX function in an m-file, or variable in a .mat file.
Mark Sherstan on 26 Dec 2019
Adding to Image Analyst's comment make sure InterX is in the same directory as the other script. I am assuming you need to use this function: https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function
Mark Sherstan on 26 Dec 2019
As long as the function and my code is in the same folder it will work, I just tested it. So if you need more help just ask!