% SCALDMO demo script on the scalogram.
%
% SCALDMO is a demo script that illustrates the capabilities
% of the scalogram function using the Morlet wavelet for
% the signal analysis.
%
% SCALDMO may be accessed from the WTDEMO command interactive
% menu, choosing the 'Scalogram' demo section.
%--------------------------------------------------------
% Copyright (C) 1994, 1995, 1996, by Universidad de Vigo
%
%
% Uvi_Wave is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Uvi_Wave; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
% Author: Santiago Gonzalez Sanchez
% Nuria Gonzalez Prelcic
% e-mail: Uvi_Wave@tsc.uvigo.es
%--------------------------------------------------------
echo on;
%--------------------------------------------------------
% Let f(t) be a continous signal and F(a,b) its continous wavelet
% transform. The representation of the modulus of the transform
% (or its phase, if it is a complex signal) in the (b,a) open
% half-plane is called a scalogram. The shift b is arbitrary and
% the scale a is strictly positive (a>0).
% The most used prototype function for signal analysis is the
% Morlet wavelet (a windowed complex exponential). The "morletw"
% function calculates this complex wavelet at any scale and
% sampled at the specified rate. Figure 1 shows its real and
% imaginary part at scale 1 and a sampling rate of 400 Hz, and
% taking the second as time unit.
[w,t]=morletw(400,1);
figure(1)
subplot(211); plot(t,real(w)); title('Real part')
subplot(212); plot(t,imag(w)); title('Imaginary part')
% Press any key to continue ...
pause
% --------------------------------------------------------
echo off
clear w
echo on
% The "scalog" function returns the scalogram of a finite length
% signal sampled at a certain rate. It uses the Morlet wavelet
% as the analyzing function. We have to set the minimum and
% maximum scale of the wavelet transform and the step between
% them. Now, we will see some example signals and their corresponding
% scalograms.
% In figure 1 you can see the first example signal: a rectangular
% pulse which has been sampled at 8 kHz.
x=[zeros(1,362) ones(1,300) zeros(1,362)];
subplot(111); plot(x)
% Now we are going to compute its scalogram from scale 1 to 20,
% with step 0.3:
figure(2)
% Please, wait ...
[sc,t,s]=scalog(x,8e3,1,20,0.3);
% We can display the modulus of the transform with a 2-D plot, using
% "show". The holes appearing in the scalogram are due to destructive
% interference between the analyzing wavelets.
colormap('pink')
show(abs(sc),1,t,s);
xlabel('Time'); ylabel('Scale')
% Press any key to continue ...
pause
%--------------------------------------------------------
% To obtain a 3-D plot we can use the "srf" function:
figure(3)
colormap('pink')
srf(abs(sc),5,5,t,s);
% On the scalogram of a signal you can clearly detect abrupt changes
% in it or in its derivatives. This is due to the good time localization
% of the wavelet transform at low scales.
% You can observe this in the preceding example, where the start and the
% end of the pulse are very sharp transitions. These changes lead to local
% maxima in the modulus of the WT.
%
% You can see this clearly in figure 3.
% When the scale grows, the analyzing wavelet dilates and then the
% scalogram focuses on long term details (the pulse itself).
% Press any key to continue ...
pause
%--------------------------------------------------------
echo off
clear s t sc
echo on
% You can set the time unit for Morlet wavelet at scale 1 or use the
% default value, which is approximated according to the input sampling
% rate. The effect of taking a shorter time unit is equivalent to decrease
% the values of the employed scales. On the other hand, a longer time
% unit corresponds to increase the scale (the prototype wavelet dilates).
% For our example signal, let us set the time unit to 0.5 ms (half the
% default value of 1 ms):
% Please, wait ...
colormap('pink')
[sc,t,s]=scalog(x,8e3,1,20,0.3,0.5e-3);
show(abs(sc),1,t,s)
xlabel('Time'); ylabel('Scale')
% As you can observe in the figure, the effect is similar to divide by 2 the
% scale values of the specified range (1 to 20).
% Press any key to continue ...
pause
%--------------------------------------------------------
echo off
clear s t sc
echo on
% Now, setting the time unit to the double of the default value.
% Please, wait ...
[sc,t,s]=scalog(x,8e3,1,20,0.3,2e-3);
show(abs(sc),1,t,s)
xlabel('Time'); ylabel('Scale')
% It is equivalent to use higher scales in the analysis.
% Press any key to continue ...
pause
%--------------------------------------------------------
echo off
close(2);close(3)
clear s t sc
echo on
% Now, we are going to calculate the scalogram for a finite signal
% composed by two tones starting and finishing at different instants.
% For example, let us take 80 and 240 Hz tones, sampled at 8 kHz:
x=[cos((2*pi*80/8000)*(0:723)) zeros(1,300)]+...
[zeros(1,400) cos((2*pi*240/8000)*(0:623))];
plot(x)
% The duration of the signal is 128 ms. The tone of lowest frequency
% finishes 37.5 ms before the end of the signal and the other one
% begins 50 ms later Figure 1 depicts this signal.
% Press any key to continue ...
pause
%--------------------------------------------------------
% We analyze the signal using the "scalog" function, with the scale ranging
% from 1 to 14 and a step of 0.1.
% Please, wait ...
figure(2); colormap('pink')
[sc,t,s]=scalog(x,8e3,1,14,0.1);
show(abs(sc),1,t,s)
xlabel('Time'); ylabel('Scale')
% Figure 2 shows its scalogram, where you can notice the presence of two
% parallel strips of constant scale, corresponding to each one of the tones.
% Moreover, you can observe their points of start and end.
% Press any key to continue ...
pause
%--------------------------------------------------------
echo off
clear s t sc
echo on
% In order to achieve a high temporal resolution, we calculate the transform
% at lower scales:
figure(3); colormap('pink')
[sc,t,s]=scalog(x,8e3,0.3,0.75,0.03);
show(abs(sc),10,t,s)
xlabel('Time'); ylabel('Scale')
% Figure 3 shows these 'zoomed' analysis of the signal.
% Press any key to continue ...
pause
%--------------------------------------------------------
echo off
clear s t sc
close(2); close(3)
echo on
% Now, let us consider a a 'chirp' signal, as depicted in the figure.
% The frequency grows linearly from 120 to 240 Hz, and the sampling
% rate is 8000 Hz again.
w=(2*pi*120/8000)*(1+(0:1023)/512);
x=cos(w.*(0:1023)); plot(x)
% We calculate its scalogram for the scales from 1 to 10, with a step 0.1
% between them. You can see it in figure 2.
% Please, wait ...
figure(2); colormap('pink')
[sc,t,s]=scalog(x,8e3,1,1
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
wouderw
- 粉丝: 346
- 资源: 2960
最新资源
- 管家婆普及版TOP9.16.zip
- ObjectARX 2025
- 电动汽车动力系统匹配与整车动力经济性计算模型:参数输入一键生成,仿真模型助力项目实践,电动汽车动力系统匹配与整车动力经济性计算模型:一键生成参数,助力高效研发仿真设计,电动汽车动力系统匹配计算模型:输
- 管家婆普及版TOP15.0.zip
- JellySprites
- chap1threading1.py
- 管家婆普及版TOP12.6.zip
- 一个随机随林的演示代码
- Deepseek使用提问公式-全是技巧
- A02114237余瑶开题报告.docx
- GESP 2024年12月认证 Python 1-6级真题和答案.rar
- 计算机软考备战指南-备考攻略详解与成功秘籍
- 管家婆普普版TOP 12.9.zip
- 管家婆普普版TOP 12.71.zip
- 管家婆普普版TOP 12.6.zip
- 【matlab代码】四个模型的IMM(交互式多模型)例程,四模型分别为:CV(匀速)、CA(匀加速)、CS(匀加加速度)、CT(匀速转弯),滤波使用EKF
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)