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
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 Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!