Performing Haar Wavelet Transform on signal consists of 1000000X1 matrix array

1 view (last 30 days)
Greetings,
I am required to perform Haar wavelet transform for a signal consists of 1000000x1 matrix array data. I'm having difficulties to use the scaling function and keep getting errors as I don't know what is the best scaling function to use for 1000000 data. Attached below is the coding for Haar wavelet which I found from several references.
%assuming InpSig = data (which consists of 1000000x1 array)
Fs = 50000;
N = length(InpSig); %number of data points
freqRes = Fs/N; %frequency resolution
freqAxisLab = freqRes*[0:N-1]; %calculate the labels for the frequency axis
fc = centfrq('haar',1); %scaling function for haar is calculated based on central frequency and level of iteration
freqrange = [1 freqAxisLab];
scalerange = fc./(freqrange*(1/Fs));
scales = scalerange(end):0.05:scalerange(1);%scalerange is the initial value:steps of the scale:end value of the scale
inpSigWAV = cwt(InpSig,scales,'haar','plot'); %CWT calculation
cwt(InpSig, scales,'haar','plot');
figure
plot(freqAxisLab, inpSigWAV,'b')
I was wondering whether my Haar wavelet coding is correct or not? Thank you in advance.

Answers (0)

Community Treasure Hunt

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

Start Hunting!