This is what my program to create a graph.. now i want to read the graph and it has to produce the y value for my input x value. is there any syntax for that?
j=input('Enter the number of straight lines in the graph: ');
for i=1:j
disp('Enter the X Y co-ordinate of one end of the straight line:'); x1(i)=input(' '); y1(i)=input(' '); disp('Enter the X Y co-ordinate of another of the straight line:'); x2(i)=input(' '); y2(i)=input(' '); c(i)=input('Enter the Y-intercept for straight line: '); m(i)=(y2(i)-y1(i))/(x2(i)-x1(i));endfor i=1:j x=x1(i):0.01:x2(i); y=((m(i))*x)+c(i); plot(x,y);%,'MarkerFaceColor','g');
hold on; %axis([-10 10 -5 5])
enddisp('-----------------------');disp('your graph is displayed');disp('-----------------------');disp('Enter the X value from your graph: ');p=input(' ');disp('Corresponding Y is: ');
Best Answer