• 大小: 2KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: Matlab
  • 标签: matlab版  

资源简介

给出了ALLAN方差的计算和拟合!最后算出随机误差的各项噪声的系数!

资源截图

代码片段和文件信息

data=load(‘1.txt‘);
format long;
start_time=10000;
n=length(data);
sf=0.0145;
signal_amp=data(start_time+1:start_time+3600)/sf;
signal_time=1*[0:1:length(signal_amp)-1];
fs=0.001;% sample frequcy unit:s
M=length(signal_time);
T=fs*M; % analysis_time unit :s
scale=[1:1:(M/10)];%将数据以10个为一小段;
for i=1:1:length(scale)
    idex=floor(M/i)*i;%将N化成能被i整除的最接近的数idex;
    mat_temp=signal_amp(1:idex);%取N中的前idex项作为mat_temp;
    if i==1
        mat_mean=mat_temp‘;
    else
        mat_mean=mean(reshape(mat_temp[i idex/i]));%把mat-temp分成i行idex/i列的数组,并求平均值;
    end    
      
    mat_diff=mat_mean(2:length(mat_mean))-mat_mean(1:length(mat_mean)-1);   
    allan(i)=(sum(mat_diff.*conj(mat_diff))/2/(length(mat_diff)-1));
   %allan(i)=sqrt(sum(mat_diff.*conj(mat_diff))/2/(length(mat_diff)-1));
end

 t=(1:length(allan))*fs;
 loglog(t

评论

共有 条评论