How can i get to get this curve in red when the vector is moving? The curve results from the displacement of the tip of the vector

조회 수: 3 (최근 30일)
The curve results from the displacement of the tip of the vector

채택된 답변

Torsten
Torsten 2025년 8월 12일
편집: Torsten 2025년 8월 13일
% Définir les vecteurs de la base O (i, j, k)
i = [1; 0; 0]; % Vecteur i
j = [0; 1; 0]; % Vecteur j
k = [0; 0; 1]; % Vecteur k
% Définir la base S avec des vecteurs unitaires (a, b, c)
a = [1; 1; 0]; % Exemple pour a, vecteur unitaire
b = [0; 1; 1]; % Exemple pour b, vecteur unitaire
c = [1; 0; 1]; % Exemple pour c, vecteur unitaire
% Normaliser les vecteurs pour assurer qu'ils sont unitaires
unit_a = a / norm(a);
unit_b = b / norm(b);
unit_c = c / norm(c);
% Créer une figure pour l'animation
figure;
axis equal;
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Animation des bases O et S');
view(3); % Vue en 3D
% Boucle d'animation
s = [];
for t = 0:0.1:2*pi
clf;
hold on;
% Tracer la base O (i, j, k)
quiver3(0, 0, 0, i(1), i(2), i(3), 'r', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'i');
quiver3(0, 0, 0, j(1), j(2), j(3), 'g', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'j');
quiver3(0, 0, 0, k(1), k(2), k(3), 'b', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'k');
% Tracer la base S à partir de l'origine i
origin_s = i; % Origine pour la base S liée à i
quiver3(origin_s(1), origin_s(2), origin_s(3), ...
-unit_a(1)* cos(t).^2 , -unit_a(2), unit_a(3)*cos(t).^2, 'k', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'a');
quiver3(origin_s(1), origin_s(2), origin_s(3), ...
unit_b(1) , unit_b(2) , unit_b(3) , 'm', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'b');
quiver3(origin_s(1), origin_s(2), origin_s(3), ...
unit_c(1) , unit_c(2) , unit_c(3) , 'c', 'LineWidth', 2, 'AutoScale', 'off', 'DisplayName', 'c');
s = [s;[origin_s(1)-unit_a(1)*cos(t)^2,origin_s(2)-unit_a(2),origin_s(3)+unit_a(3)*cos(t)^2]];
plot3(s(:,1),s(:,2),s(:,3),'r','LineWidth', 2,'DisplayName','s')
% Mettre à jour la légende et les axes
legend('show');
% Pause pour créer l'effet d'animation
pause(0.1);
hold off;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by