www.pudn.com > 1.rar > zhuchengxu.asv, change:2011-03-27,size:823b


close all 
clear all 
clc 
cd('C:\Program Files\MATLAB71\work\2nd_test');%%%%%%%%%%%读数据 
Allname=struct2cell(dir);  %%%%%%%%%%%结构体 
[m,n]=size(Allname); 
for i=1:n-2 
    Imdata=importdata(Allname{1,i+2}); 
    x=Imdata;%%%%%%%%%%%%%%%%%%%%%%%%将第i个文件数据赋给x 1表示第一个通道 
    N=20480; 
    x=x(1:N,:);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%取x中的前10240个点进行分析 
    fs=20000;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%采样频率 
  
 for j=1:4 
       x(:,j)=abs(hilbert(x(:,j))); 
       f=(0:N/2-1)/N*fs; 
       f=f'; 
       time(i,:,j)=time_statistical_compute(x(:,j));%%%%%%%多维矩阵计算时域特征矩阵 
       xfft(:,j)=fft(x(:,j),N)/N; 
       y(:,j)=2*abs(xfft(1:N/2)); 
       fre(i,:,j)=fre_statistical_compute(f,y(:,j));%%%%%%%多维矩阵计算频域特征矩阵 
       feature(i,:,j)=[time(i,:,j),fre(i,:,j)]; 
       end 
end