Matlab Animation for 4d plots?

4 ビュー (過去 30 日間)
Anurag Chittanahalli Papegowda
Anurag Chittanahalli Papegowda 2018 年 6 月 27 日
回答済み: Gautam 2024 年 10 月 23 日 12:06
Hello, could anybody please tell me is it possible to do 4d animated plots , if so how? Thank you

回答 (1 件)

Gautam
Gautam 2024 年 10 月 23 日 12:06
One way to make animated plots by updaing the plot inside a loop:
numTimePoints = 100;
t = linspace(0, 10, numTimePoints); % Time vector
x = sin(t);
y = cos(t);
z = t;
figure;
hold on;
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
view(3);
line = plot3(x(1), y(1), z(1), 'b-', 'LineWidth', 2);
head = plot3(x(1), y(1), z(1), 'ro', 'MarkerSize', 8, 'MarkerFaceColor', 'r');
% Plot the trajectory as an animation
for i = 1:numTimePoints
line.XData = x(1:i);
line.YData = y(1:i);
line.ZData = z(1:i);
head.XData = x(i);
head.YData = y(i);
head.ZData = z(i);
pause(0.05);
end
This give the output as

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by