# Hello, please help me solve this problem in converting cwt.

2 views (last 30 days)
Muhammad Deeb on 2 Nov 2021
Commented: DGM on 2 Nov 2021
clc
clear
close all
%%
Fs = 1e3;
t = 0:1/Fs:2;
x = cos(2*pi*32*t).*(t>=0.1 & t<0.3) + exp(-t.^4).*sin(2*pi*64*t).*(t>=0.7 & t<1)+4*exp(-t).*sin(2*pi*20*t).*(t>=0.9);
plot(t,x,'color',[0 0 0])
xlabel('Time(s)')
ylabel('Function value')
fig = gcf;
set(0,'DefaultFigureWindowStyle','normal')
set(fig,'Position', [500 300 600 300]);
box on
ax = gca;
ax.LineWidth = 2;
ax.FontSize = 10;
ax.FontAngle = 'normal';
ax.FontWeight = 'Bold';
figure
cwt(x,Fs)
fig = gcf;
set(0,'DefaultFigureWindowStyle','normal')
set(fig,'Position', [500 300 600 300]);
box on
ax = gca;
ax.LineWidth = 2;
ax.FontSize = 10;
ax.FontAngle = 'normal';
ax.FontWeight = 'Bold';
%%
figure ;
wgnNoise = .4*randn(size(t));
x1 = x + wgnNoise;
plot(t,x1,'color',[0 0 0])
xlabel('Time(s)')
ylabel('Function value')
fig = gcf;
set(0,'DefaultFigureWindowStyle','normal')
set(fig,'Position', [500 300 600 300]);
box on
ax = gca;
ax.LineWidth = 2;
ax.FontSize = 10;
ax.FontAngle = 'normal';
ax.FontWeight = 'Bold';
figure
cwt(x1,Fs)
fig = gcf;
set(0,'DefaultFigureWindowStyle','normal')
set(fig,'Position', [500 300 600 300]);
box on
ax = gca;
ax.LineWidth = 2;
ax.FontSize = 10;
ax.FontAngle = 'normal';
ax.FontWeight = 'Bold';
When executing the program I get the following error message:
Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2
Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.
> In mmm2 at 16
Error using cwt (line 145)
Not enough input arguments.
Error in mmm2 (line 21)
cwt(x,Fs)
##### 1 CommentShowHide None
DGM on 2 Nov 2021
I don't have WT, but this seems to run fine in-browser.
Fs = 1e3;
t = 0:1/Fs:2;
x = cos(2*pi*32*t).*(t>=0.1 & t<0.3) + exp(-t.^4).*sin(2*pi*64*t).*(t>=0.7 & t<1)+4*exp(-t).*sin(2*pi*20*t).*(t>=0.9);
% ...
cwt(x,Fs) I see there is more than one version of cwt(), as it's changed across versions.
If you're stuck with the older version, I'm guessing you'll have to figure out if you can use it for your purposes. The syntax and output differ, and the documentation is a bit sparse.