Need code to find standard deviation?

8 次查看(过去 30 天)
Muhammad Tarique
Muhammad Tarique 2023-1-29
回答: Tejas 2024-11-13,9:35
how to find SD of a signal (double) using all mothers wavelets (all available in wavelet 1-D) at only 6th level of decomposition. For now I am using wavelet analyzer which is consuming so much time. I want results like:
Mother Wavelet SD
haar 0.07341
db1 0.07341
db2 0.03707
db3 0.0263
db4 0.0342
db5 0.03597
db6 0.02833
db7 0.03212
db8 0.03629
db9 0.03118
db10 0.03043
sym2 0.03707
sym3 0.0263

回答(1 个)

Tejas
Tejas 2024-11-13,9:35
Hello Muhammad,
To calculate the standard deviation of level 6 decomposition of a signal, using multiple wavelets, try these steps:
  • Start by declaring the list of wavelets to be used.
signal = randn(1, 1000); %Replace this with your input signal
waveletList = {'haar', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'sym2', 'sym3'};
  • For each wavelet, use the 'wavedec' function to decompose the signal, the 'detcoef' function to find the coefficients, and the 'std' function to determine the standard deviation.
for i = 1:length(waveletList)
waveletName = waveletList{i};
[C, L] = wavedec(signal, 6, waveletName);
D6 = detcoef(C, L, 6);
sd = std(D6);
fprintf('%s %.5f\n', waveletName, sd)
end
For a better understanding of the solution, refer to these documentations:

类别

Help CenterFile Exchange 中查找有关 Signal Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by