?? program_02_01.m
字號(hào):
function program_02_01();
% 多個(gè)尺度連續(xù)小波變換的實(shí)現(xiàn)
clc;clear
% 下載信號(hào)
load vonkoch
vonkoch=vonkoch(1:510);
% 尺度1-32的連續(xù)小波變換
S_Min=1;S_Max=32;
index=0;
for scale=S_Max:-1:S_Min;
index=index+1;
cwt_coef(index,:)=Singularity_Detection(scale,32*(scale),vonkoch);
end
% 小波系數(shù)取模
cwtcoef_abs=abs(cwt_coef);
% 顯示
for index=S_Min:S_Max
max_coef=max(cwtcoef_abs(index,:)); % 系數(shù)模最大
min_coef=min(cwtcoef_abs(index,:)); % 系數(shù)模最小
ext=max_coef-min_coef; % 系數(shù)模跨度
cwtcoef_abs(index,:)=64*(cwtcoef_abs(index,:)-min_coef)/ext; % 系數(shù)大小變換
end
figure(1)
subplot(2,1,1);
plot(vonkoch);
xlabel('時(shí)間')
ylabel('幅度')
title('分形信號(hào)')
axis([1 510 0 0.02])
subplot(2,1,2)
colormap(pink(64));
image(cwtcoef_abs)
set(gca,'YTick',2:3:32)
set(gca,'YTickLabel',32:-3:2)
title('連續(xù)小波變換時(shí)間尺度圖')
xlabel('時(shí)間')
ylabel('尺度')
% 某個(gè)尺度的連續(xù)小波變換的M函數(shù)
% delta 小波變換的尺度
% N 小波函數(shù)的長度
% s 原始信號(hào)
% g 原始信號(hào)某個(gè)尺度下的小波變換系數(shù)
function g=Singularity_Detection(delta,N,s);
% 原始信號(hào)長度
n=length(s);
% 構(gòu)造墨西哥帽子小波函數(shù)
for index_x=1:N;
x=index_x-(N+1)/2;
phi_x(index_x)=((pi^(-1/4))*(2/sqrt(3)))*(1-x.*x/(delta^2))*exp(-(x.*x)/(2*delta^2));
end;
phi_x=phi_x/norm(phi_x); % 能量歸一化
% 對(duì)信號(hào)做卷積
g=conv(s,phi_x); % 卷積
g=wkeep(g,n); % 保持信號(hào)長度
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -