|
楼主 |
发表于 2015-11-28 11:47
|
显示全部楼层
全矢谱程序
- clear;
- clc;
- load('gu.txt');
- x=gu(:,3);%导入x信号
- y=gu(:,4);%导入y信号
- N=1024;fs=2048;
- df=fs/N;
- z=x+i*y;
- Z=fft(z)*2;
- for k=1:N/2
- Xp(k)=abs(Z(k))/(2*N);%正进动圆半径
- Xr(k)=abs(Z(N+1-k))/(2*N);%反进动圆半径
- PhaP(k)=angle(Z(k))*180/pi;%正进动圆起始相位角
- PhaR(k)=angle(Z(N+1-k))*180/pi;%反进动圆起始相位角
- RL(k)=Xp(k)+Xr(k);%椭圆长轴
- RS(k)=Xp(k)-Xr(k);%椭圆短轴
- Pha(k)=(PhaP(k)+PhaR(k))/2;%相位角
- end
- f=df*(0:N/2-1);
- subplot(2,1,1);
- plot(f,RL);
- xlabel('频率');ylabel('主振矢幅值/um');
- %set(gca,'XTick',(0:20:100),'XTickLabel',{'0','x','2x','3x','4x','5x'});
- axis([0,1000,0,60]);
- grid on ;
- title('全矢谱');
- subplot(2,1,2),plot(f,Pha);
- xlabel('频率');ylabel('相位角度/(°)');
- %set(gca,'XTick',(0:20:100),'XTickLabel',{'0','x','2x','3x','4x','5x'});
- set(gca,'YTick',(-180:90:180),'YTickLabel',{'-180','-90','0','90','180'});
- axis([0,1000,-180,180]);grid on
复制代码 |
|