How to a creat a sweeping radius, like that of a radar.
조회 수: 3 (최근 30일)
이전 댓글 표시
For my university assignment I have to create a projectile simulator in the form of a radar, and I am struggling to create a radius that sweeps through the circle and was wondering if anyone could help, thanks very much.
댓글 수: 0
답변 (3개)
Wayne King
2014년 2월 20일
It's easy enough to simulate that, but are you just interested in something for visual effect? In other words, not tied to any underlying computation.
theta=0:.01:2*pi;
y=exp(1i*theta);
for j=1:length(theta)
h=compass(real(y(j)),imag(y(j)));
set(h,'linewidth',2);
set(h,'color',[0 0 0])
title('(cos(\theta),sin(\theta))','fontsize',18);
pause(.01);
end
댓글 수: 0
Iain
2014년 2월 20일
This is NOT the full answer, but it should get you started.
a = plot([0 xmax],[0 0],'r-');
hold on
b = plot(x,y,'bx');
c = plot(x1,y1,'cx');
for i = 0:360
set(a,'XData',[0, xmax],'YData',[0 ymax*sin(i*pi/180)])
% figure out how close the line is to passing a marker, and if its close enough
set(b,'Markersize',BIG)
% and if it's not...
set(c,'Markersize',small)
pause(0.1)
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!