資源簡介
數(shù)據(jù)預(yù)處理中去除異常值的程序,matlab寫的。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
代碼片段和文件信息
%此函數(shù)用來將系統(tǒng)中存在的異常值進行剔除
%輸入?yún)?shù):
%y--?待處理的數(shù)據(jù)序列
%lamda-?差分處理的系數(shù),該值越大,剔除的條件越嚴格
%?輸出參數(shù):
%y-----返回處理后的數(shù)據(jù)序列
function?[y]?=?de_abnormal(ylamda)
[mlp]=size(y);
if?m>lp
????lp=m;
end
i=6;
while?i ????slope?=?0;
????for?j=1:4
????????slope?=?slope?+?abs((y(i-j)-y(i-j-1)));
????end
????if?abs(y(i)-y(i-1))?>?lamda*?slope/4
????????if?abs(y(i+1)-y(i-1))>lamda*slope/4
????????????if?abs(y(i+2)-y(i-1))>lamda*slope/4
????????????????if?abs(y(i+3)-y(i-1))>lamda*slope/4
????????????????????i=i+4;
????????????????????continue;
??????
評論
共有 條評論