How to a creat a sweeping radius, like that of a radar.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (3)
Wayne King
am 20 Feb. 2014
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 Kommentare
Iain
am 20 Feb. 2014
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 Kommentare
Siehe auch
Kategorien
Mehr zu Polar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!