数据分析1 重复精度分析

读取测量值,计算周期,将数据分组,分析数据重复精度及分布:


clear;

dg1= xlsread('0808','C:C');
fs=200;
nfft= 2^nextpow2(length(dg1));%找出大于y的个数的最大的2的指数值(自动进算最佳FFT步长nfft)%nfft=1024;%人为设置FFT的步长nfft
y=dg1-mean(dg1);%去除直流分量
y_ft=fft(y,nfft);%对y信号进行DFT,得到频率的幅值分布
y_p= y_ft.*conj(y_ft)/nfft;%conj()函数是求y函数的共轭复数,实数的共轭复数是他本身。
y_f= fs/2*linspace(0,1,nfft/2);%变换后对应的频率的序列,% y_p=y_ft.*conj(y_ft)/nfft;%conj()函数是求y函数的共轭复数,实数的共轭复数是他本


y_pp=10*log10(y_p(1:nfft/2));
pmax= y_pp(find(diff(sign(diff(y_pp)))==-2)+1);
fmax= y_f(find(diff(sign(diff(y_pp)))==-2)+1);
[ppmax,findex]=sort(pmax,'descend');
ffmax=fmax(findex);


figure(1),
plot(y_f,10*log10(y_p(1:nfft/2)));axis([0,0.5,-10,inf]);grid on,xlabel('频率(Hz)');ylabel('功率谱密度(dB)');title('功率谱密度');
for i=1:10
text(ffmax(1,i),ppmax(i,1),[num2str(1/ffmax(1,i)) 's'],'FontSize',16,'Color',[1 0 0]);
end


%semilogy(y_f,y_p(1:nfft/2));axis([0,0.5,0.1,1000000]) %y对数坐标
 
[V,T1]=max(y_p(1:nfft/2)); %求出赋值最大值及对应小标
text(y_f(T1),y_p(T1),['T=' num2str(1/y_f(T1))],'FontSize',16,'Color',[1 0 0]);
T=1/y_f(T1);%求出数据周期


cycle=round(T*fs)-1; %求出数据周期对应点数,需要浮点数转化为整数
for xx=1:1:120
    test(xx,:)=dg1([((xx-1)*cycle+1):cycle*xx],1);
end


for aa=1:10
times=10*aa;
error(aa,:)=max(test([1:times],:))-min(test([1:times],:));
end
stdr=std(test,0,1); %标准差
meanr=mean(test,1); %均值


clear nfft y y_p y_f y_ft T1 xx aa times;


t=0:1/fs:(1/fs)*(cycle-1);
figure(2);
subplot(3,1,2);plot(t,error([1,5,10],:));legend('10 Times','50 Times','100 Times');title('Running Repeatablity Test');xlabel('Stepper running time (s)');ylabel('Repeatablity (mm)')
subplot(3,1,1);plot(t,test([1,60,100],:));title('Running Curve');xlabel('Stepper running time (s)');ylabel('Laser measuring result 100 cycles (mm)');
text(35,1,['T=' num2str(cycle/fs) 's'],'FontSize',16,'Color',[1 0 0]);
subplot(3,1,3);plot(t,stdr); title('120 times ruuning std');xlabel('Stepper running time (s)');ylabel('Laser measuring result std (mm)');
[~,tindex]=max(stdr);text(t(tindex),stdr(tindex),['3\sigma=' num2str(3*stdr(tindex))],'FontSize',16,'Color',[1 0 0]);


figure(3);
subplot(3,1,1);plot(test(:,find(t==21.4)),'g+');
subplot(3,1,2);sfpin(test(:,find(t==21.4)));
%[a,b]=hist(test(:,find(t==21.88)));
%bar(b,a/sum(a));
subplot(3,1,3);qqs(test(:,find(t==21.4)));
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值