How to a creat a sweeping radius, like that of a radar.
4 ビュー (過去 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 で Waveform-Level Simulations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!