Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
ma Jack
ma Jack am 8 Jul. 2022
Bearbeitet: Chunru am 8 Jul. 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).

Akzeptierte Antwort

Chunru
Chunru am 8 Jul. 2022
Bearbeitet: Chunru am 8 Jul. 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

Weitere Antworten (0)

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by