I need to plot a trajectory, of a point on circumference of a circle moving around its centre and centre is moving along its x-axis.

7 次查看(过去 30 天)
% please help i dont undrestand

回答(1 个)

KSSV
KSSV 2020-2-20
% cicle
th = linspace(0,2*pi) ;
r = 1. ;
xc = r*cos(th) ;
yc = r*sin(th) ;
% center of circle movine along ax axes
x = linspace(0,15,100) ;
y = zeros(size(x)) ;
% plot
for i = 1:length(x)
figure(1)
for j = 1:length(xc)
plot(x(i)+xc(1:j),y(i)+yc(1:j)) ;
axis([-5 15 -2 2])
drawnow
end
end
Better is to use set. Read about it.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by