Optimization of Wavelet Analysis - Code Execution Time

1 回表示 (過去 30 日間)
Velu Prabhakar Kumaravel
Velu Prabhakar Kumaravel 2020 年 7 月 1 日
回答済み: Chaitanya Mallela 2020 年 7 月 13 日
Hello,
Could someone help me to understand why does it take so much time to execute the following piece of code:
tic
frange = [2 20]; % Frequency range I am interested
wname = 'mexh'; % Wavelet Name
C = 124; % number of sensors
S = 67534; % number of samples
data = randn(C,S); % Input Data
energy_mean = zeros(1,C);
f = scal2frq(1:500,wname,1/250); % Computing the Pseudo Frequency
indices = f >= frange(1) & f <=frange(2); % Finding the indices of frange
for c = 1:C % For each sensor data
x = data(c,:);
CWTcoeffs = cwt(x,1:500,wname); % compute coefficients
cfs = CWTcoeffs(indices,:).^2;
energy_mean(ch) = 10*log10(mean(mean(cfs,2))); % average power in db
end
toc
Elapsed time is 918.298398 seconds.
Any help is greatly appreciated to reduce the execution time. Thanks.
-Velu

回答 (1 件)

Chaitanya Mallela
Chaitanya Mallela 2020 年 7 月 13 日
cwt function is taking more computations try using cwtfilterbank with reduced VoicesperOctave to speed up the execution.

カテゴリ

Help Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by