%input raw data and zeroed the mean value
N=32768;
fs =48000;
t = (0:N-1)/fs;
f=(0:N-1)*fs/N;
x=X136_DE_time(1:1:N)-mean(X136_DE_time(1:1:N));
x=x';
figure(1), clf;
plot(t,x),grid on;
title('raw waveform');
% Signal decomposition into high-Q and low-Q components
Q1=5;Q2=1;J1=66;J2=7;r1=3.5;r2=3.5;
now1 = ComputeNow(N,Q1,r1,J1,'radix2'); % Compute norms of wavelets
now2 = ComputeNow(N,Q2,r2,J2,'radix2'); % Compute norms of wavelets
lam1 = now1; % Regularization params for high Q-factor TQWT
lam2 = now2; % Regularization params for low Q-factor TQWT
mu = 2.0; % SALSA parameter
Nit = 200; % Number of iterations
[x1,x2,w1s,w2s,costfn] = dualQ(x,Q1,r1,J1,Q2,r2,J2,lam1,lam2,mu,Nit);
% Plot high-Q and low-Q components of the signal
figure(2);
subplot(2,1,1)
plot(t,x1)
box off
title('HIGH Q-FACTOR COMPONENT')
subplot(2,1,2)
plot(t,x2)
box off
title('LOW Q-FACTOR COMPONENT')
xlabel('TIME (SECONDS)')
% plot the location picture
figure(3),clf;
subplot(3,1,1)
plot(t(1:N/128),x(1:N/128)),grid on;
title('Q1=5;Q2=1;J1=66;J2=7;r1=3.5;r2=3.5; WAVEFORM')
box off
subplot(3,1,2)
plot(t(1:N/128),x1(1:N/128)),grid;
title('HIGH Q-FACTOR COMPONENT')
box off
subplot(3,1,3)
plot(t(1:N/128),x2(1:N/128)),grid;
title('LOW Q-FACTOR COMPONENT')
box off
%review the subbands
figure(4),
plotsubbands(x1,w1s,Q1,r1,1,J1+1,fs);
figure(5),
plotsubbands(x2,w2s,Q2,r2,1,J2+1,fs);
figure(6),
subplot(2,1,1),
plotEnergy(w1s);
subplot(2,1,2),
plotEnergy(w2s);
%analysis the high energy subbands(resonance subbands)
%high component
z=zeros(size(x1));
w1z=tqwt_radix2(z,Q1,r1,J1);
w=w1z;
% w{7}=w1s{7};
w{18}=w1s{18};
w{19}=w1s{19};
w{20}=w1s{20};
w{21}=w1s{21};
% w{16}=w1s{16};
% w{17}=w1s{17};
% w{23}=w1s{23};
% w{24}=w1s{24};
x1main=itqwt_radix2(w,Q1,r1,N);
figure(7),
plot(t(1:N/10),x1main(1:N/10));
%low component
z=zeros(size(x2));
w2z=tqwt_radix2(z,Q2,r2,J2);
w=w2z;
% w{2}=w2s{2};
w{3}=w2s{3};
w{4}=w2s{4};
w{5}=w2s{5};
w{6}=w2s{6};
% w{7}=w2s{7};
x2main=itqwt_radix2(w,Q2,r2,N);
figure(8),
plot(t(1:N/10),x2main(1:N/10));
%envelop demodulation of x1main and x2main
envelop1=abs(hilbert(x1main));
envelop2=abs(hilbert(x2main));
figure(9),clf;
subplot(2,1,1);
plot(t(1:N/10),envelop1(1:N/10));
title('envelop1 waveform');
subplot(2,1,2);
plot(t(1:N/10),envelop2(1:N/10));
title('envelop2 waveform');
%fft map of envelop line
envelop1fft=uDFT(envelop1);
envelop2fft=uDFT(envelop2);
mag1=abs(envelop1fft);
mag2=abs(envelop2fft);
figure(10),clf;
subplot(2,1,1);
plot(f(1:N/8),mag1(1:N/8));
title('envelop1 fft');
subplot(2,1,2);
plot(f(1:N/8),mag2(1:N/8));
title('envelop2 fft');
评论2