• 大小: 590B
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-10-16
  • 语言: Matlab
  • 标签: LDA  

资源简介

使用LDA(线性判别分析)算法提取一维数字信号(数组)的特征,可用于信号的分类识别。

资源截图

代码片段和文件信息

function [V_selectFV1D1] = TYZmyLDA(MatdogMathum)
[rowdcold]=size(Matdog);
[rowhcolh]=size(Mathum);
n=rowd+rowh;
MeanDog=mean(Matdog);
MeanHum=mean(Mathum);
Xdog=Matdog-repmat(MeanDogrowd1);
Xhum=Mathum-repmat(MeanDogrowh1);
%狗的类内散度矩阵
for i=1:rowd
SwDog=+(Xdog(i:))‘*Xdog(i:);
end
%人的类内散度矩阵
for j=1:rowh
SwHum=+(Xhum(j:))‘*Xhum(j:);
end
Sw=(SwDog+SwHum);%类内散布矩阵
%下面计算类间散布矩阵Sb
Mat=[Matdog;Mathum];
MeanMat=mean(Mat);
D11=MeanDog-MeanMat;
D22=MeanHum-MeanMat;
Sb=(rowd*D11‘*D11+rowh*D22‘*D22);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%相位使用1025
Sbw=Sb-Sw+eye(1025);%%%%%%%%%%避免矩阵奇异,出现复数特征值
[V1 D1] = eigs(Sbw);
V_select=abs(V1(:4:6));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%频谱使用411-5HZ的特征
% Sbw=Sb-Sw+eye(41);%%%%%%%%%%避免矩阵奇异,出现复数特征值
% [V1 D1] = eigs(Sbw25);
% V_select=abs(V1);
%%%%%%%%%%%%%%%%%%
V=V1;
D=D1;
F=Mat*V_select;
%%%%%%%%%%%%%%%%%%%%%%%----end----%%%%%%%%%%%%%%%%%%%%%%%%%%%

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1047  2013-07-10 17:28  TYZmyLDA.m

----------- ---------  ---------- -----  ----

                 1047                    1


评论

共有 条评论