wavelete_energy_decompose.m
上传用户:xhrjvip
上传日期:2020-11-07
资源大小:2k
文件大小:1k
源码类别:

生物技术

开发平台:

Matlab

  1. function [x_delta,x_theta,x_apha,x_beta]=wavelete_energy_decompose(x)
  2. %小波分解
  3. [c,l]=wavedec(x,8,'db3');
  4. %下面的程序是对信号用小波进行分解。
  5. ca8=wrcoef('a',c,l,'db3',8);%心电、眼电干扰
  6. cd8=wrcoef('d',c,l,'db3',8);%0.41~0.82   delta波
  7. cd7=wrcoef('d',c,l,'db3',7);%0.82~1.64   delta波
  8. cd6=wrcoef('d',c,l,'db3',6);%1.64~3.28   delta波
  9. cd5=wrcoef('d',c,l,'db3',5);%3.28~6.56   theta波
  10. cd4=wrcoef('d',c,l,'db3',4);%6.56~13.13  apha波
  11. cd3=wrcoef('d',c,l,'db3',3);%13.13~26.25 beta波
  12. cd2=wrcoef('d',c,l,'db3',2);%26.25~52.25 高频噪声
  13. cd1=wrcoef('d',c,l,'db3',1);%52.25~105   高频噪声
  14. %下面的程序时对小波分解的近似信号的系数提取
  15. %N=[1,2,3,4,5,6,7,8];
  16. %[D1,D2,D3,D4,D5,D6,D7,D8]=detcoef(c,l,[N(1),N(2),N(3),N(4),N(5),N(6),N(7),N(8)]);
  17. %%%对delta系数求绝对和
  18. %x_delta=sum(abs(D8)^2)+sum(abs(D7)^2)+sum(abs(D6)^2);
  19. x_delta=sum(abs((cd8)).^2)+sum(abs((cd7)).^2)+sum(abs((cd6)).^2);
  20. %%%theta系数
  21. %x_theta=sum(abs(D5)^2);
  22. x_theta=sum(abs((cd5)).^2);
  23. %%%apha系数
  24. %x_apha=sum(abs(D4)^2);
  25. x_apha=sum(abs((cd4)).^2);
  26. %%%beta系数
  27. %x_beta=sum(abs(D3)^2);
  28. x_beta=sum(abs((cd3)).^2);
  29. %%%能量归一化
  30. energy_sum=x_delta+x_theta+x_apha+x_beta;
  31. x_delta=x_delta/energy_sum;
  32. x_theta=x_theta/energy_sum;
  33. x_apha=x_apha/energy_sum;
  34. x_beta=x_beta/energy_sum;