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

4 次查看(过去 30 天)
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).

采纳的回答

Chunru
Chunru 2022-7-8
编辑:Chunru 2022-7-8
% 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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by