Animation of multiple Quivers
11 ビュー (過去 30 日間)
古いコメントを表示
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 ?
0 件のコメント
回答 (1 件)
Adam Danz
2023 年 2 月 12 日
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!