# How to specify frequency range in new cwt function?

23 views (last 30 days)
Kirill Kukushkin on 6 May 2022
Edited: Jonas on 6 May 2022
I need to investigate complex signal from some physics experiment. I want to use not Short-time Fourier transform, but Continuous Wavelet transform (Morlet wavelet). The frequencies of phenomena I am interested in lie in the range from 10 kHz to 100-1000 kHz.
While using the old version of function 'cwt' I set required frequency range using old cwt-function argument 'scale'. But I dont know, how to do it with new version of cwt-function. When I try to make scalogram using new 'cwt' with default parameters, upper frequency limit is something just like 1 kHz. Sampling frequency of the signal is constant and equals 0.25 mcs. I tried set Fs parameter of new 'cwt' as 0.25 mcs, but upper limit however is 1kHz.
How to specify frequency range using new cwt function?
Example of old 'cwt' function code and scalogram:
fstart=1;% starting frequency limit for scalogram, kHz
fend=100;% ending frequency limit for scalogram, kHz
step=1; %step, kHz
OMEGA=fstart*(10^3):step*(10^3):fend*(10^3);
scales = 3.25*(10^6)./OMEGA
coefs = cwt(y,scales,'morl','abslvl'); Here is the code and the picture of the new cwt scalogram with incorrect frequency range (0 Hz - 1 kHz):
step = Signal.scale_time(2) - Signal.scale_time(1); %ADC step
sample_rate = 1/step;
cwt(Signal.data, "morse", sample_rate); Jonas on 6 May 2022
Edited: Jonas on 6 May 2022
to specifythe frequency range use
cwt(yourSignal,signalFs,'FrequencyLimits',[10 100]*10^3)
however, you cannot specify the frequencies at which you want to evaluate the cwt. you can only specify the number of calculated values per octave (1 to 48 in the latest matlab release) and those values are spaced logarithmically (many values at lower frequency range, few in the upper). values per octaves can then be calculated with an additional Name-Value pair using 'VoicesPerOctave'
what you could do is to call the cwt function repeatedly with 'VoicesPerOctave' set to 1 and specifying the FrequencyLimits to
[frequencyYouAreInterestedIn/2 frequencyYouAreInterestedIn],
which will then evaluate the cwt at frequencyYouAreInterestedIn. This way you can calculate and concatentthe values one by one. watch out near fs/2 and the lower bounds which you can get using the the function cwtfreqbounds()
Jonas on 6 May 2022
and please note, that the results of the ild and new cwt are not the same since the nrw cwt function uses L1 normalization. You can find more about this in the documentation of course

R2021b

### Community Treasure Hunt

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

Start Hunting!