monthrun.m

来自「采用simulink搭建的BPSK调制解调模块」· M 代码 · 共 25 行

M
25
字号
figure('color',[1 1 1])
bcolor=[0,1,0];
x0=300;
y0=100;
%eearth=line(300,400,'color','r','linestyle','.','markersize',100);
head=line(x0,y0,'color',bcolor,'linestyle','.','erasemode','xor','markersize',30);
mmonth=line(x0,y0,'color','r','linestyle','.','erasemode','xor','markersize',100);    %定义小球格式
%head=line(x0,y0,'color','r','linestyle','.','erasemode','xor','markersize',40);  
a=1000;b=200;                                                              
theta=0;                                                      
%x0=a*cos(theta);                                                 
%y0=b*sin(theta);                                                
axis([-1500,1500,-1500,1500]);                                       
axis('off');                                                      
t=0;                                                              
dt=0.001;                                                          
while 1                                                           %死循环(关闭窗口后中止循环)
   t=t+dt;
   theta=theta+dt;                                 %计算时刻 t 时的幅角                               
   x=a*cos(theta);                                                %计算时刻 t 时的 x 坐标
   y=b*sin(theta);                                                %计算时刻 t 时的 y 坐标
   set(head,'xdata',x,'ydata',y);                                 %计算时刻 t 时小球的位置
   drawnow;                                                       %重画小球与悬线
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?