Continuous wavelet transform implementation using morlet
20 次查看(过去 30 天)
显示 更早的评论
hi , I wanted to implement Morlet based CWT function
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163953/image.png)
Morlet wavlet is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163954/image.png)
my aim is to find the CWT coefficients a,b (scaling, shifting parameters) I have a recorded audio signal has 81410x1 double & sampling rate is 44100
x=audioread('rec2.wav'); a0 = 2^(1/32); scales = a0.^(0.5*32:1*32); % scaling has to be 1.65 to 2 , Is this right way to scaling ? [cfs,sc,frequencies] = cwt(x,scales,'cmor1-1.5',1,'scal');
when i run this code i was getting cfs [13x81410] complex double matrix
So this cfs matrix represents a & b from the 1st equn ? and trying to plot the cfs matrix , how to do that? and Later i want to do squaring of a&b coeff and plot it ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163956/image.png)
0 个评论
回答(3 个)
Wayne King
2016-5-12
Hi Vinod, First, I would recommend using CWTFT as opposed to CWT. The default wavelet for CWTFT is the "analytic" Morlet wavelet which is proportional to the expression you have, it is essentially a complex exponential with a default radian frequency of 6, or cyclical frequency of 6/(2\pi) -- f_0 in your expression.
I'm not sure what your aim is with this analysis but I don't think your scales vector is correct. You are using scales that are much too small to be usable.
CWTFT provides default scales, but if you want, you can specify them. Something that would be a good place to start would be
dt = 1/44100;
s0 = 2*dt;
a0 = 2^(1/10); % 10 voices per octave
scales = s0*a0.^(0:14*10); % 14 octaves
Then you call CWTFT with
cwtx = cwtft({x,dt},'scales',scales);
The output is a structure array with a frequencies field. That field contains the approximate scale to frequency conversion for each row of the matrix, cwtx.cfs.
Each row of the matrix is a value of "a" the scaling parameter. This is the CWT so the translation is fixed at 1. Each row of the matrix is equal to the original signal length.
0 个评论
vinod naidu
2016-5-13
编辑:vinod naidu
2016-5-13
well my intention is to find the the peaks of my recorded audio signal when it exceeds certain threshold (0.40) and consider the peak when it happens within the time interval of (100-160m sec)
on the y axis summation of squared frequency components , x-axis time reff,
x=audioread('C:\Users\Vinod Naidu\Documents\Audacity Recordings\rec2.wav'); Fs= numel(x); % number of samples dt = 1/Fs; % sampling period t = 0:dt:1-dt; % Time interval
s0 = 2*dt;
a0 = 2^(1/10); % 10 voices per octave
scales = s0*a0.^(0:14*10); % 14 octaves
cwtx = cwtft({x,dt},'scales',scales);
plot(t*1000,abs(cwtx.cfs(1,:).^2)*1000); % magnitude plot
the output is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174295/image.png)
How to find out the peak has happened at threshold within the time interval ?
I have attached my recorded signal
1 个评论
Wayne King
2016-5-13
When you say 0.4, are you referring to a value in the original signal units? Because you don't have any value greater than 0.4 in your original data. Or are you simply referring to values in the wavelet domain?
Why are you scaling the magnitude-squared wavelet coefficients by 1000?
vinod naidu
2016-5-16
well it was my mistake, now i would like to find out my peak when it exceeds the 0.0002
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174319/image.png)
and I would like to know which curve fitting method is suitable for my output cause i wanted to do conform a peak when the start and end points values( +/- 58m sec) form peak values are less then the threshold values
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!