Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
ma Jack
ma Jack le 8 Juil 2022
Modifié(e) : Chunru le 8 Juil 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).

Réponse acceptée

Chunru
Chunru le 8 Juil 2022
Modifié(e) : Chunru le 8 Juil 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

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by