Finding points on a line from user input
이전 댓글 표시
The question is as follows: 'Make a function file “e82.m” with 5 input parameters. The first four are two pairs of xand y- coordinates (x1, y1, x2, y2 ) and the fifth, a single x-value. The first four are two dots in a y-x plot. Connect these with a line and the fifth value is also a dot on the same line, but you should find out the corresponding y-value and present everything in a plot. Of course the five parameters must be chosen to be arbitrary.'
so far I have this: xvalueone = 'x value between 0 and 10'; xvalue = input(xvalueone); a=xvalue/10
yvalueone = 'y value between 0 and 10'; yvalue = input(yvalueone); b=yvalue/10
xvaluetwo = 'second x value between 0 and 10'; xvalue = input(xvaluetwo); c=xvalue/10
yvaluetwo = 'second y value between 0 and 10'; yvalue = input(yvaluetwo); d=yvalue/10
A=[a,c] B=[b,d]
plot(A,B,'-')
input ('select x value between the previous two values')
BUT I don't know how to get the corresponding value from the line.
Thanks for any help
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!