资源简介
用matlab详细编写了一个ALLAN方差的程序,经过了调试可以绘制角度随机游走、速率斜坡等噪声分析模型。
代码片段和文件信息
% function J12G_allan(originalfileTocolumnK)
clear all;
clc;
To=0.1; %请输入采样周期!
K=23000;%请输入标度因数!
phnumber=1/To;
shuju=load(‘1200.dat‘)/To*3600/K; %导入测试数据!
if phnumber~=1;
for i=1:fix(length(shuju)/phnumber)-1;
pinghua(i)=0;
for j=1:phnumber;
pinghua(i)=pinghua(i)+shuju((i-1)*phnumber+j);
end;
pinghua(i)=pinghua(i)/phnumber;
end;
end;
lengtha=length(pinghua); %平滑后数组的长度
JianGe=1:lengtha/2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ALLAN(1:length(JianGe))=0; %ALLAN点数
%%%%%%%%%%%%%%%%%%%%
clear k;
for k=1:1:length(JianGe);
clear pingjun;
qunshu=fix(lengtha/JianGe(k));
for i=1:qunshu;
pingjun(i)=0;
for m=1:JianGe(k);
pingjun(i)=pingjun(i)+pinghua(m+JianGe(k)*(i-1));
end;
pingjun(i)=pingjun(i)/JianGe(k);
end;
cha=diff(pingjun);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for n=1:1:qunshu-1;
ALLAN(k)=ALLAN(k)+cha(n)*cha(n);
end;
ALLAN(k)=sqrt(ALLAN(k)/(qunshu-1))/sqrt(2);
end;
%%%%%%%%%%%Z=H*X+V的最小二乘法求解%%%%%%%%%%%%%%%%
T=JianGe‘;
xx=[T.^2T.^1ones(length(T)1)T.^(-1)T.^(-2)];
NIAL
评论
共有 条评论