Borrar filtros
Borrar filtros

How does matlab go about drawing an image like the one below?

4 visualizaciones (últimos 30 días)
ma Jack
ma Jack el 8 de Jul. de 2022
Editada: Chunru el 8 de Jul. de 2022
Hi all,
I recently wanted to draw a graphic (below, this is a simple example I drew using PPT):
It consists of a black dot and two red arrows.
I now have a set of data about the position of the black points and the red vector (with each black point as the coordinate origin), how do I plot an image like the one above using matlab? Does anyone have any suggestions? Thanks in advance.
Additions:
The data is in the form of a black point at [xx,yy] and a red vector (arrow) at [a,b] (starting at the black point where the red arrow is).

Respuesta aceptada

Chunru
Chunru el 8 de Jul. de 2022
Editada: Chunru el 8 de Jul. de 2022
% x y ux1 uy1 ux2 uy2
data = [1 2 0.1 -0.3 1 1;
5 3 1 2 -1 -1
2 5 -1 -2 -0.5 0] ;
figure; hold on;
s = 0.3; % control the length of arrow
quiver(data(:,1), data(:,2), data(:,3), data(:,4), s, 'r-');
quiver(data(:,1), data(:,2), data(:,5), data(:,6), s, 'r-');
plot(data(:,1), data(:,2), 'bo', 'MarkerFaceColor', 'b');
axis equal

Más respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by