Difficulty using the CWT function

조회 수: 20 (최근 30일)
David Uygun
David Uygun 2017년 12월 1일
답변: David Uygun 2017년 12월 5일
Hi,
I'm getting a lot of this:
>> cwt(data,'bump',fs);
Undefined function 'sqrt' for input arguments of type 'char'.
Error in cwt (line 278) coefs(ind,:) = -sqrt(a)*wkeep1(diff(wconv1(ySIG,f)),lenSIG);
I'm also getting quite a bit of this:
Error using wavemngr (line 254) Invalid wavelet name: amor.
Error in wavemngr (line 354) i_fam = wavemngr('indw',varargin{1});
Error in intwave (line 74) wtype = wavemngr('type',wname);
Error in cwt (line 187) [val_WAV,xWAV] = intwave(WAV,precis);
I've tried all the wavelet names that I'm able to find in the docs but Morlet (amor/mor1) is what I'm after.
essentially, I just want to plot a time-frequency analysis using continuous wavelet transform. I'm fairly sure I'm using the syntax used in the help documentation but I can't get it to work.
What should I do?
Thanks
  댓글 수: 1
Nick Choi
Nick Choi 2017년 12월 4일
To use Morlet as a wavelet name, 'morl' should be used according to the following documentation page:
The following documentation page provides an example of how to perform time-frequency analysis using continuous wavelet transform:
If you are able to run the example, it would be helpful if you could provide the reproduction code and data files that were causing the original error messages.

댓글을 달려면 로그인하십시오.

답변 (3개)

David Uygun
David Uygun 2017년 12월 4일
Thanks very much for the reply. That seemed to get me past the bit I was stuck on. However, now I get this error message. I have not been able to use the data from the example so I'm using my own data which is just a time series in a vector.
>> fs = 1000; >> [cfs,f] = cwt(data,fs,'morl',[14,200]); helperCWTTimeFreqPlot(cfs,tquad,f,'surf','CWT of Quadratic Chirp','Seconds','Hz') Error using cwt (line 296) The sampling period must be specified to obtain frequencies and the 'scal' flag must be specified to obtain the scalogram.
Undefined function or variable 'tquad'.
Did you mean: >> helperCWTTimeFreqPlot(cfs,quad,F,'surf','CWT of Quadratic Chirp','Seconds','Hz') Not enough input arguments.
Error in quad (line 57) f = fcnchk(funfcn);
I'm not sure where I should specify the sampling period in the code. Having read the documentation , my understanding is I should specify the the sampling frequency.

Nick Choi
Nick Choi 2017년 12월 5일
It seems as though the error messages are being generated because the new and old versions of the 'cwt' function are being called in various the code snippets.
Since the syntax differs between the two function versions, I would suggest going through your code to ensure that the syntax corresponds to the newer version of the function as described in the release notes:
This would help facilitate the debugging process.

David Uygun
David Uygun 2017년 12월 5일
Thanks very much. Your suggestion has helped me make some progress. I'm able to plot the scalogram but I'm still stuck trying to plot the frequency on the y-axis rather than the scales.
>> DT = 1/fs;
[wt,f] = cwt(data1,DT,'morl','plot'); colormap jet; c = colorbar; Error using cwt (line 296) The sampling period must be specified to obtain frequencies and the 'scal' flag must be specified to obtain the scalogram.
I've also tried [wt,f] = cwt(data1,fs,'morl','plot'); colormap jet; c = colorbar; and I get the same error message.
Any chance you can see what I'm doing wrong here?
Thanks

카테고리

Help CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by