Animation of multiple Quivers

11 Ansichten (letzte 30 Tage)
Jonas Giebeler
Jonas Giebeler am 12 Feb. 2023
Beantwortet: Adam Danz am 12 Feb. 2023
Hello,
my problem is a bit more complex but it can basically be broken down to the followning:
I have 2 vectors where one vector starts at the end of the first one. I want to create an animated plot with a "for loop" where the first vector is stationary and the second one rotates by 360° around the end of the first one. My problem is, that i can only create 2 quivers in one plot by using the "hold" command, which then also holds each of the 360° animated timesteps. This is not the intended result because i want to create a rotating vector and not a series of multiple vectors.
Is there a way to solve this ?

Antworten (1)

Adam Danz
Adam Danz am 12 Feb. 2023
The hold command merely prevents the axes from being cleared when you add new graphics objects to the axes. You can manipulate the values of a quiver arrow during the for-loop. quiverrotate from the file exchange might come in handy although it sounds like you could achive this without using a 3rd party function.
Example:
h = quiver([0 1],[0 0],[1 0],[0 1],'off','LineWidth',2);
axis equal
xlim([-0.5 2.5])
ylim([-1 1])
grid on
theta = linspace(pi/2,2.5*pi,20);
[u,v] = pol2cart(theta,ones(size(theta)));
for i = 1:numel(theta)
h.UData(2) = u(i);
h.VData(2) = v(i);
drawnow
end

Kategorien

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

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by