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

2 次查看(过去 30 天)
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 个评论
DGM
DGM 2021-11-2
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by