Finding points on a line from user input
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (1)
Brian
el 16 de Jun. de 2013
0 votos
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!