本人画了一个空间的扫描轨迹,红色代表扫描的斜边,绿色为扫描的轨迹。现在求助如何始终只存在一条红色线,下面绿色的轨迹线保留。代码如下: clear all; clc; close all; w=8*pi;%角速度 v=10;%下落速度为10m/s %下落高度 130-20 %探测角是30度 %斜距是150 75 %1!!!画动态螺旋曲线%% % z = peaks(0); surf(z) hold on t=linspace(13,0,1000); x=v*t.*cos(w*t); y=v*t.*sin(w*t); z=v*t; h1=animatedline; h2=animatedline('color', 'g'); h1.Color = 'r'; h1.LineWidth = 1.0; h1.LineStyle = '-'; axis([-150,150,-150,150]); title('扫描轨迹'); for i = 2:length(t) % addpoints(h1,x(i),y(i),z(i)); a=[x(i),y(i),0]; quiver3(0,0,z(i),x(i),y(i),-z(i),0,'ShowArrowHead','off','Color','r'); addpoints(h2,x(i),y(i),0); pause(0.02); drawnow %hold on; end %hold off; 附件上是目前的图,希望在扫描过程中始终只存在一条红色斜边。 |
最佳答案
1 条回复