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

2 views (last 30 days)
The curve results from the displacement of the tip of the vector

Accepted Answer

Torsten
Torsten on 12 Aug 2025
Edited: Torsten on 13 Aug 2025
% 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

More Answers (0)

Categories

Find more on Graphics in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!