i want an animation of a point to follow my curve ??? i have tried but not getting it?

1 vue (au cours des 30 derniers jours)
Rahul Jangid
Rahul Jangid le 3 Déc 2021
Commenté : Rahul Jangid le 6 Déc 2021
clc
clear
% close all
%% Input
CP = 4;
syms u v
Po = [-40 -40 0]; %Attacking missile origin
P1 = [-30 -30 45];
P2 = [-20 -20 35];
P3 = [-10 -10 0]; %Target point
%% Attacking missile(Short range rocket and artillery shells) path using Bazier curve
P= [Po
P1
P2
P3];
U = [u^3 u^2 u 1];
M = [-1 3 -3 1
3 -6 3 0
-3 3 0 0
1 0 0 0];
R(u) = U*M*P ;
%% Indexing of points to draw curve
i=1;
e=100;
for u = 0:1/e:1
C= R(u)
for k = 0:length(i)
Xr(k)= C(i,1);
Yr(k)= C(i,2);
Zr(k)= C(i,3);
% p= C(u,1)
% q= C(u,2)
% r= C(u,3)
rod = plot3(Xr(k),Yr(k),Zr(k),'-o','Color','b','MarkerSize',10,'MarkerFaceColor','#D9FFFF') ;
drawnow
% pause(0.01);
% delete(rod);
end
Xr(i)= C(:,1)
Yr(i)= C(:,2);
Zr(i)= C(:,3);
% for a= 1:e
% Xr(i)= C(a,1)
% Yr(i)= C(a,2)
% Zr(i)= C(a,3)
% end
i=i+1;
end
%% Ploting 3d bazier curve
plot3(P(:,1),P(:,2),P(:,3),'--g*') %ploting control polygon
hold on
p=plot3(Xr,Yr,Zr,'-','Color','r') ; %ploting BAZIER CURVE
p.LineWidth = 2;

Réponses (1)

Image Analyst
Image Analyst le 3 Déc 2021
Try removing the % symbol in front of the pause() and delete() lines.
  3 commentaires
Image Analyst
Image Analyst le 3 Déc 2021
Sorry, I don't have the Symbolic Toolbox. Can you convert the u and v to numerical vectors? Then increase the pause to 0.5 seconds.
Rahul Jangid
Rahul Jangid le 6 Déc 2021
bro actually i am new so i dont know how to do it, and
i want to play two loop simultaniously can you suggest me how to do it ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by