different vector length after downsampling by wavedec algorithm and downsample function

1 view (last 30 days)
Good day,
I'm writing a code for processing some signal which includes descrete wavelet decomposition. I'm reading a signal from the .txt file which includes the time data scale and signal values scale. Wavedec function pefrorms the downsampling by 2 for each level of decomposition of my "signal values" signal. To make the "time data" signal the same length as the wavelet-decomposed signal I wrote a cycle for downsampling, but the problem is that the wavelet decomposed signal and downsamplet time data signal have the dfferent length at the output. The input signals are the same length.
here's the code:
if true
clear all;
close all;
data = load('offset_eeg_kawakatsu.txt');
j=4;
w='db4';
lineLOW=62000;
lineHIGH=182000;
diff=((lineHIGH-lineLOW)+1)/2^j
while (mod(diff,1) ~= 0)
lineHIGH=lineHIGH+1;
diff=((lineHIGH-lineLOW)+1)/2^j;
disp 'executed';
end
T=data(lineLOW:lineHIGH,1);
for m=1:j
if (m == 1);
T_downsamp=downsample(T,2);
m=m+1;
else
T_downsamp=downsample(T_downsamp,2);
m=m+1;
end
end
figure;
for ch=2:5
S=data(lineLOW:lineHIGH,ch);
[c,l]=wavedec(S,j,w);
S_down=detcoef(c,l,j);
subplot(4,1,1),plot(T_downsamp,S_down);
title(['Decomposed signal(Detail coeff) Ch',num2str(ch-1)])
end
end
How can I solve the problem with the different length of time data signal and signal values signal?

Answers (1)

Filipp
Filipp on 6 Jan 2014
Still cant solve the problem

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!