Undefined function 'cwt' for input arguments of type 'double'.

I am currently conducting a CWT for my rail roughness. However, the errors keep showing "Undefined function 'cwt' for input arguments of type 'double'." Not sure if it is due to the input arguements for my roughamplitude? Any possible advice for cwt.
Below is my sample code
d2spectogram=xlsread('Nel20190802_MEAS35_displacement_results.xlsx');
dist=d2spectogram(:,4);
rough=d2spectogram(:,2);
rows = numel(dist);
sampdist = abs ((dist(rows) - dist(1)))/(rows-1);
totallength = dist(rows) -dist(1);
ylabel ('Roughness (um)');
xlabel ('Distance (m)');
windowsize=512;
window = hann(windowsize);
%window
nfft=2^nextpow2(windowsize); %size of the fft %hsv
noverlap=nfft*0.5; % 50% set for number of overlaps
fs_samp=1/0.001; %i have my sampling frequency
roughamplitude = rough - mean(rough); %focus on fluctuation
%continuous wavelet transform
%CWT of partial signal
[cwtW,cwtF]=cwt(roughamplitude,'amor',fs_samp);%morlet wavelength
cwtW_mag=abs(CwtW); %magnitutde cwt
cwtW_pow=cwtW_mag.^2;
figure
surf(t,cwtF,cwtW_mag,'EdgeColor','none');
colormap(jet);axis tight;view(0,90);
h=colorbar;ylabel(h,'Magnitude');
title('Wavelet transform of amplitutde signal');
xlabel('Time (s)'); ylabel('Frequency (Hz)');
surf(t,cwtF,cwtW_mag,'EdgeColor','none');
colormap(jet);axis tight;view(0,90);
h=colorbar;ylabel(h,'Magnitude');
title('Scalogram of amplitutde signal');
xlabel('Distance'); ylabel('Frequency (Hz)');

3 Comments

The cwt function is part of the Wavelet Toolbox. Yoou have to have the Toolbox installed to use the function.
To see if you have it, type:
ver 'wavelet'
in a script or in your Command Window. If you have it, among other items, you should see something similar to:
Wavelet Toolbox Version 5.3 (R2019b)
in your Command Window as output.
how do i go about installing the toolbox. seems like i do not have it.
"Warning: No properly formatted Contents.m file was found"
for 'wavelet'.
That depends on the environment you are working in. If you are in a university, contact your license administrator. If you have an individual license, you will have to purchase it. Contact MathWorks Sales for more information.

Sign in to comment.

Answers (0)

Asked:

on 11 Oct 2019

Commented:

on 11 Oct 2019

Community Treasure Hunt

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

Start Hunting!