好的,我把前面的一部分补上,其实那部分只是一个小波分解和重构程序,很普通,没什么的。
我只是不明白后面,也就是我贴出来的,又是FFT又是HILBERT,一会又求平均值到底有什么作用,这样处理的结果给出的是什么物理量或是物理意义。
%含噪的三角波与正弦波的组合
%生成正弦信号
clc;
clear;
close all;
N=1000;
t=0:0.001:0.6;
x=sin(2*pi*50*t)+sin(2*pi*120*t);
y=x+2*randn(size(t));
figure;
subplot(211)
plot(t,y,'LineWidth',2);
subplot(212)
plot(1000*t(1:50),y(1:50));
%xlabel('sample number n');
%ylabel('amplitude A');
%wavelet 1D decompose
[c,l]=wavedec(y,7,'db10');
% reconstruct 1-7 layer approach coefficient.
a7=wrcoef('a',c,l,'db10',7);
a6=wrcoef('a',c,l,'db10',6);
a5=wrcoef('a',c,l,'db10',5);
a4=wrcoef('a',c,l,'db10',4);
a3=wrcoef('a',c,l,'db10',3);
a2=wrcoef('a',c,l,'db10',2);
a1=wrcoef('a',c,l,'db10',1);
% show approach coefficient
figure
subplot(7,1,1);
plot(a7,'LineWidth',2);
ylabel('a7');
subplot(7,1,2);
plot(a6,'LineWidth',2);
ylabel('a6');
subplot(7,1,3);
plot(a5,'LineWidth',2);
ylabel('a5');
subplot(7,1,4);
plot(a4,'LineWidth',2);
ylabel('a4');
subplot(7,1,5);
plot(a3,'LineWidth',2);
ylabel('a3');
subplot(7,1,6);
plot(a2,'LineWidth',2);
ylabel('a2');
subplot(7,1,7);
plot(a1,'LineWidth',2);
ylabel('a1');
xlabel('sample sequence n');
% reconstruction 1-7 layer details coefficient
d7=wrcoef('d',c,l,'db10',7);
d6=wrcoef('d',c,l,'db10',6);
d5=wrcoef('d',c,l,'db10',5);
d4=wrcoef('d',c,l,'db10',4);
d3=wrcoef('d',c,l,'db10',3);
d2=wrcoef('d',c,l,'db10',2);
d1=wrcoef('d',c,l,'db10',1);
% show detail coefficient
figure
subplot(7,1,1);
plot(d7,'LineWidth',2);
ylabel('d7');
subplot(7,1,2);
plot(d7,'LineWidth',2);
ylabel('d6');
subplot(7,1,3);
plot(d5,'LineWidth',2);
ylabel('db5');
subplot(7,1,4);
plot(d5,'LineWidth',2);
ylabel('d4');
subplot(7,1,5);
plot(d3,'LineWidth',2);
ylabel('d3');
subplot(7,1,6);
plot(d2,'LineWidth',2);
ylabel('d2');
subplot(7,1,7);
plot(d1,'LineWidth',2);
ylabel('d1');
xlabel('sample squence n'); |