我正在对矩阵B
(126 x 7) 进行中值绝对偏差异常值分析。我认为我下面的代码可以正常工作,但我收到关于尺寸不匹配的错误。谁能帮我?我仍然是 MATLAB 的初学者。
b = B; %identifying raw data for outlier analysis
k=size(B,2); %preallocating size of loop to run to be equivalent to number columns in B
for j= 1:k
a=b(:,j); %identify data used
fa = abs(a-median(a))./(mad(a,1)./.6745); %if x>3.5 then outlier
dec_mad=fa>2.24; %logical operator identifying outlier
nout(j)=sum(dec_mad); %sum of outliers
x = dec_mad ==0; % logical of data with outliers removed
b(:,j) = a(x); %data without outliers
end