关于matlab程序 PCA变换代码有些地方没看懂![M,N,bs] = size(multi);multi_mean = mean(mean(multi)); %多光谱影像各波段均值multi_Cx = 0; %协方差矩阵for i = 1 :Mfor j = 1 :Nmulti_S = multi(i,j,:);multi_S = multi_S - multi_mean;
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/01 07:01:56
关于matlab程序 PCA变换代码有些地方没看懂![M,N,bs] = size(multi);multi_mean = mean(mean(multi)); %多光谱影像各波段均值multi_Cx = 0; %协方差矩阵for i = 1 :Mfor j = 1 :Nmulti_S = multi(i,j,:);multi_S = multi_S - multi_mean;
关于matlab程序 PCA变换代码有些地方没看懂!
[M,N,bs] = size(multi);
multi_mean = mean(mean(multi)); %多光谱影像各波段均值
multi_Cx = 0; %协方差矩阵
for i = 1 :M
for j = 1 :N
multi_S = multi(i,j,:);
multi_S = multi_S - multi_mean;
multi_S = reshape(multi_S,bs,1); % 转换为bs行向量
multi_Cx = multi_Cx + multi_S * multi_S'; 这一步是求协方差的吗?
end
end
multi_Cx = multi_Cx / (bs - 1); 为什么要除以(bs-1)?
关于matlab程序 PCA变换代码有些地方没看懂![M,N,bs] = size(multi);multi_mean = mean(mean(multi)); %多光谱影像各波段均值multi_Cx = 0; %协方差矩阵for i = 1 :Mfor j = 1 :Nmulti_S = multi(i,j,:);multi_S = multi_S - multi_mean;
multi_Cx = multi_Cx + multi_S * multi_S' --------------- 这一步是求协方差的中间过程
multi_Cx = multi_Cx / (bs - 1);------------------------这个是协方差矩阵