📄 xinhao1.m
字号:
%采样频率为1000Hz;%数据长度为1024;%信号生成t=0:0.001:1.023;for i=1:1024 x(i)=8*sin(80*pi*t(i))+6*sin(200*pi*t(i))+sin(280*pi*t(i)); if t(i)<=0.2 s(i)=0; else s(i)=20*sin(2*pi*200*t(i)+pi/3).*exp(-20*(t(i)-0.2)); endendx=x+s;%graph signal xfigure(1);plot(t,x);xlabel('time/s');ylabel('amplitude/mv');title('signal x');axis([0 1.023 -40 40]);%3level 2^4=16, choose db wavelet package decompositionwptree=wpdec(x,3,'db3'); %wpdec functionplot(wptree); %wavelet package tree figure(3);%section 1 to section 8 分解结果for i=0:7 subplot(4,2,i+1); section=wprcoef(wptree,[3 i]); plot(section);axis([0 1024 min(section) max(section)]); grid on;title(['section',num2str(i)]); end %Energy 每层的能量图谱for i=1:3 wptree=wpdec(x,i,'db3'); e=wenergy(wptree); figure(4); subplot(3,1,i); bar(e); axis([0 length(e) 0 150]); title(['第 ',num2str(i), ' 层']); for j=1:length(e) text(j-0.2,e(j)+20,num2str(e(j),'%2.2f')); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -