📄 program_09_09.m
字号:
% 设置小波函数、时间间隔和采样点数
wname = 'db10';
A = -64; B = 64; P = 224;
% 计算采样周期和采样函数及真实频率
delta = (B-A)/(P-1);
t = linspace(A,B,P);
omega = 5; x = cos(omega*t);
freq = omega/(2*pi);
% 设置尺度并且使用scal2frq函数来计算准周期数列
scales = [0.25:0.25:3.75];
TAB_PF = scal2frq(scales,wname,delta);
% 计算最近似的准周期和相应的尺度
[dummy,ind] = min(abs(TAB_PF-freq));
freq_APP = TAB_PF(ind);
scale_APP = scales(ind);
% 进行连续分解并绘图
str1 = ['224 samples of x = cos(5t) on [-64,64] - ' ...
'真实频率 = 5/(2*pi) =~ ' num2str(freq,3)];
str2 = ['准周期数组和尺度: '];
str3 = [num2str([TAB_PF',scales'],3)];
str4 = ['准频率 = ' num2str(freq_APP,3)];
str5 = ['对应尺度 = ' num2str(scale_APP,3)];
figure; cwt(x,scales,wname,'plot'); ax = gca; colorbar
axTITL = get(ax,'title');
axXLAB = get(ax,'xlabel');
set(axTITL,'String',str1)
set(axXLAB,'String',[str4,' - ' str5])
clc ;
disp(strvcat(' ',str1,' ',str2,str3,' ',str4,str5))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -