|
楼主 |
发表于 2006-5-12 09:49
|
显示全部楼层
晕,程序没附上...粘在下面了
<P>clear;<BR>%*********************************************************************<BR>%全谱、全息谱、全矢谱分析<BR>N=512;<BR>fh=200; fs=32*fh; %采样频率<BR>dt=1/fs; %采样时间间隔<BR>t=0:dt:512/fs-dt; u=2*pi*fh*t;<BR>x=2*sin(0.25*u+10/180*pi)+4*sin(0.75*u+30/180*pi)+20*sin(u-20/180*pi)+10*sin(2*u-50/180*pi)+5*sin(3*u+40/180*pi)+3*cos(4*u-60/180*pi); %信号序列1<BR>y=sin(0.25*u+20/180*pi)+3*sin(0.75*u+10/180*pi)+15*sin(u-20/180*pi)+8*sin(2*u+30/180*pi)+5*sin(3*u-40/180*pi)+2*cos(4*u-50/180*pi); %信号序列2<BR>%x=2*sin(0.25*u+10/180*pi)+4*sin(0.75*u+30/180*pi)+20*sin(u-20/180*pi)+10*sin(2*u-50/180*pi)+5*sin(3*u+40/180*pi)+3*cos(4*u-60/180*pi)+2*sin(5.25*u+10/180*pi)+4*sin(5.75*u+30/180*pi)+20*sin(6*u-20/180*pi)+10*sin(12*u-50/180*pi)+5*sin(18*u+40/180*pi)+3*cos(24*u-60/180*pi); %信号序列1<BR>%y=sin(0.25*u+20/180*pi)+3*sin(0.75*u+10/180*pi)+15*sin(u-20/180*pi)+8*sin(2*u+30/180*pi)+5*sin(3*u-40/180*pi)+2*cos(4*u-50/180*pi)+sin(5.25*u+20/180*pi)+3*sin(5.75*u+10/180*pi)+15*sin(6*u-20/180*pi)+8*sin(12*u+30/180*pi)+5*sin(18*u-40/180*pi)+2*cos(24*u-50/180*pi); %信号序列2<BR>%x=15*sin(u+20/180*pi);<BR>%y=10*sin(u+10/180*pi);<BR>z=x+y*i;<BR>fz=fft(z);<BR>ZReal=real(fz)/512;ZImag=imag(fz)/512;<BR>ZR1=ZReal(1:256);ZI1=ZImag(1:256);<BR>for i=1:256<BR> ZR2(i)=ZReal(512-i+1);<BR> ZI2(i)=ZImag(512-i+1);<BR>end; <BR>XP=sqrt(ZR1.^2+ZI1.^2);<BR>XR=sqrt(ZR2.^2+ZI2.^2);<BR>for i=1:255;<BR> XP(i)=XP(i+1);<BR>end;<BR>RA=XP+XR; %计算椭圆长半轴 <BR>RB=XP-XR; %计算椭圆短半轴<BR>faiP=phase(ZR1,ZI1,256); <BR>faiR=-phase(ZR2,ZI2,256);<BR>faiA=1/2*(faiP-faiR);</P>
<P><BR>H1=figure('Name','VECTORSPEC WLY 2005/01','NumberTitle','off','Position',[370 400 280 300]); %矢量谱分析窗口<BR>%*********************************************************************<BR>subplot(3,1,1);<BR>whitebg('w'); <BR>plot(RA,'k'); axis([0 160 0 30]); % 画出长半轴图<BR>set(gcf,'Color',[1 1 1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>set(gca,'XTick',1:32:200);<BR>set(gca,'XTicklabel',{'','',''});<BR>ylabel('长半轴');<BR>%*********************************************************************<BR>subplot(3,1,2);<BR>plot(RB,'k'); axis([0 160 -20 20]); % 画出短半轴图<BR>set(gcf,'Color',[1 1 1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>set(gca,'XTick',1:32:200);<BR>set(gca,'XTicklabel',{'','','','','','',''});<BR>ylabel('短半轴');<BR>%*********************************************************************<BR>subplot(3,1,3);<BR>plot(faiA,'k'); axis([0 160 -180 180]); % 画出方位角图<BR>set(gcf,'Color',[1 1 1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>set(gca,'XTick',1:32:200);<BR>set(gca,'XTicklabel',{'0X','2X','4X','6X','8X','10X','12X'});<BR>ylabel('方位角/度');<BR>%*********************************************************************<BR>H2=figure('Name','FULLSPEC WLY 2005/01','NumberTitle','off','Position',[660 400 280 300]); %全谱分析窗口<BR>subplot(3,1,1);<BR>whitebg('w'); </P>
<P>plot(XP,'k'); hold on; axis([-160 160 0 20]);% 画出全谱图<BR>t1=1:256;<BR>plot(-t1,XR,'k'); </P>
<P>set(gcf,'Color',[1 1 1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>set(gca,'XTick',-128:32:128);<BR>set(gca,'XTicklabel',{ '-8X','-6X','-4X','-2X','0X','2X','4X','6X','8X'});</P>
<P>ylabel('全谱');<BR>%*********************************************************************<BR>subplot(3,1,2);</P>
<P>for i=1:8;<BR> t=1:128;<BR> e=16*i;<BR> w=(2*pi)/128;<BR> q=pi/180;<BR> x1=XP(e)*cos(w*t+faiP(e)*q)+XR(e)*cos(w*t+faiR(e)*q)+e;<BR> y1=XP(e)*sin(w*t+faiP(e)*q)-XR(e)*sin(w*t+faiR(e)*q);<BR> plot(x1,y1,'k'); axis([0 200 -40 40]);% 画出全息谱图<BR> hold on<BR>end<BR>set(gcf,'Color',[1,1,1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>set(gca,'XTick',1:16:200);<BR>set(gca,'XTicklabel',{'0X','1X','2X','3X','4X','5X','6X','7X','8X','9X'});<BR>ylabel('全息谱');<BR>%*********************************************************************<BR>subplot(3,1,3);<BR>plot(z,'k'); % 画出轴心轨迹图<BR>set(gcf,'Color',[1 1 1]);<BR>set(gca,'Ygrid','on','Xgrid','on','FontName','Arial','FontSize',8);<BR>ylabel('轴心轨迹图');<BR>%*********************************************************************<BR></P> |
|