0
votes

I'am trying to compute CWT(continuous wavelet transform) of a 1-D signal using the command cwt it takes 3 input arguments

  1. x- the input 1-D dignal.
  2. scales- scales is a 1-D vector with positive elements.
  3. wavename- it is the wavelet name which are inbuilt in matlab.

it returns a matrix having no. of rows equal to the length of scale vector. No. of columns equal to the length of input vector x.

now, I want a plot of log scale versus the coefficient plot bur while taking log scale I'am ending up getting a zero. and hence the cwt command is not responding(i.e.) it is giving an error message following is the small code.

clc;clear all 
load vonkoch
vonkoch=vonkoch(1:510); 
len = length(vonkoch);
scale=0.01:0.01:1;logscale=log(scale);
cw1 = cwt(vonkoch,scale,'mexh','plot'); 
title('Continuous Transform, absolute coefficients.') 
ylabel('Scale')
[cw1,sc] = cwt(vonkoch,scale,'mexh','scal');
title('Scalogram') 
ylabel('Scale') 

and the error message is

Error using cwt (line 74)

Invalid Value for Scales !

Error in exmp1 (line 6)

cw1 = cwt(vonkoch,logscale,'mexh','plot');

Kindly suggest what I can do to avoid such a problem or is there any other command that can do the trick?

1
Welcome to StackOverflow. You may want to edit your code to reflect that you're calling cwt with logscale. - zeeMonkeez

1 Answers

1
votes

If I understand you correctly, what you want to do is this:

[cw1,sc] = cwt(vonkoch,scale,'mexh','scal');
ph = pcolor(1:len,scale,sc);
ph.EdgeColor = 'none';
set(gca, 'YScale', 'log');