📄 acousticfeatures.m
字号:
clear all;
%-----------------------------------------------------------------------------------------------
%Feature Extaction specific
j=1;
%fileName = textread('e:\data\BAE\filelist\ml_bae_filelist1.txt','%s','delimiter','\n','whitespace','');
%source = 'bae';
for k=3:3,
switch k
case 1,
fileName = textread('d:\acousticq1.txt','%s','delimiter','\n','whitespace','');
source = 'q1';
type = char(['v'*ones(1,152) 'n'*ones(1,127)]); % 'v' (vehicle) or 'n' (noise)
case 2,
fileName = textread('d:\acousticq2.txt','%s','delimiter','\n','whitespace','');
source = 'q2';
type = char(['v'*ones(1,137) 'n'*ones(1,116)]); % 'v' (vehicle) or 'n' (noise)
case 3,
fileName = textread('d:\acousticq3.txt','%s','delimiter','\n','whitespace','');
source = 'q3';
type = char(['v'*ones(1,131) 'n'*ones(1,224)]); % 'v' (vehicle) or 'n' (noise)
end
Datadir = 'd:\';
Fs = 4960;
%Fs = 1024;
nclasses=3;
%-----------------------------------------------------------------------------------------------
FRmat = [];
Frmatb = [];
Frmatc = [];
Fmat = [];
Fmatb = [];
Fmatc = [];
fileCount = length(fileName);
fprintf('\nNo of Files are %d\n',i, fileCount);
for i = 1:fileCount
% extract all features for this run
clear sdata;
filen = fileName{i};
load([Datadir fileName{i}]); % sdata
[trash,filen] = strtok(filen,'\');
[trash,filen] = strtok(filen,'\');
[trash,filen] = strtok(filen,'\');
[trash,filen] = strtok(filen,'\');
[filen,trash] = strtok(filen,'\');
eval(['sdata = ' filen '; clear ' filen ';']);
fprintf('\nfile no:(%d) %s of type [%s]\n',i, fileName{i},type(i));
[F,FR] = afm_mlpatternGen(sdata,Fs,type(i));
FR = randomize(FR);
F = randomize(F);
FRmat = [FRmat; FR];
% Frmatb = [Frmatb; mean(FR,1) j];
% Frmatc = [Frmatc; median(FR,1) j];
% Fmat = [Fmat; F j*ones(size(F,1),1)];
% Fmatb = [Fmatb; mean(F,1) j];
% Fmatc = [Fmatc; median(F,1) j];
j=j+1;
end
FRmat = randomize(FRmat);
% Frmatb = randomize(Frmatb);
% Frmatc = randomize(Frmatc);
% Fmat = randomize(Fmat);
% Fmatb = randomize(Fmatb);
% Fmatc = randomize(Fmatc);
% eval(['save ' Datadir 'Feature_2a_' source ' Frmatb -ascii']); % save partitioned patterns based on runs
% eval(['save ' Datadir 'Feature_2b_' source ' Frmatc -ascii']); % save partitioned patterns based on runs
eval(['save ' Datadir 'Feature_1_' source ' FRmat -ascii']); % save partitioned patterns based on runs
% eval(['save ' Datadir 'Feature_7a_' source ' Fmatb']); % save partitioned patterns based on runs
% eval(['save ' Datadir 'Feature_7b_' source ' Fmatc']); % save partitioned patterns based on runs
% eval(['save ' Datadir 'Feature_6_' source ' Fmat']); % save partitioned patterns based on runs
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -