Can you rotate a shape based on quiver direction?

1 vue (au cours des 30 derniers jours)
Yash le 14 Juin 2022
I am currenly plotting an animation of an object with a quiver based on the x and y coordinates as well and the x nad y velocities. I was wondering if I can adjusting the tilt of a rectangle that I am plotting based on the direction of the quiver? Currently, the dimensions of the rectangle are defined as shown in the code below and it always stays facing the same direction.
for k=1:length(Ycord)
clf
for i=1:5
hold on
grid on
plot(Xcord(k,i),Ycord(k,i),'.');
quiver(Xcord(k,i),Ycord(k,i),Xvel(k,i),Yvel(k,i),'LineWidth',1);
rectangle('Position',[Xcord(k,i)-1,Ycord(k,i),2,4],'EdgeColor','k','LineWidth', 1);
end
pause(0.1)
end
0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Réponses (1)

Sean de Wolski le 14 Juin 2022
Look at hgtransform
0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Catégories

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

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by