Drag a point on a curve
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Here is my code:
xmin=0;xmax=3;
ymin=0;ymax=3;
x=linspace(xmin,xmax);
y=1/3*x.^2;
plot(x,y)
hold on
plot(1.5,1/3*1.5^2,'o',...
'MarkerFaceColor','r')
hold on
plot([0,1.5,1.5],[1/3*1.5^2,1/3*1.5^2,0],'r--')
quiver(0,0,0,1/3*1.5^2,0,...
'LineWidth',1,...
'Color','black')
quiver(0,0,1.5,0,0,...
'LineWidth',1,...
'Color','black')
quiver(0,0,1.5,1/3*1.5^2,0,...
'LineWidth',1,...
'Color','black')
grid on
hold off
shg
Which produces this image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170936/image.png)
Is it possible to write the code so that I can use my mouse to drag the point on the curve and get it coordinates as it moves. Then I want to update my arrows and dashed lines.
If it is not possible to drag the point, then can you show me how to use a slider to move the point, get its coordinates, and update my arrows and dashed lines.
0 comentarios
Respuestas (1)
Sujit Muduli
el 6 de Mzo. de 2018
Hi David,
You may find the link below relevant to what you are asking for, please have a look at it. https://in.mathworks.com/matlabcentral/answers/94353-how-can-i-select-multiple-points-using-the-data-cursor-and-export-the-coordinates-to-the-matlab-work
Thanks,
Sujit
0 comentarios
Ver también
Categorías
Más información sobre Vector Fields en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!