1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| clear all;
close all;
clc;
% Creation du signal a transformer
x=0:0.1:200.01;
y=sin(x);
z=sin(2*x);
y(length(y)/2:length(y))=z(length(y)/2:length(y));
%%%%%%%%%%%
sig=40; %parametre pour la fonction chapeau_psi
p=180; %nombre de fois que l'on va changer d'echelle
W=zeros(p,length(x)); %Matrice des coefficients d'ondelette
%On va faire varier l'echelle de l'analyse
%Plus l'echelle est grande et plus elle est situee haute dans la matrice W
a0=2;
for i=0:p-5
a=a0^(i/20); %´echelle
%calcul des coefficients dondelettes a lechelle a
for b=0:length(x)-1
%On translate et on dilate l'ondelette
tmp=ones(1,length(x))*b;
t=(x-tmp)*a;
W(p-i-4,b+1)=(1/sqrt(a))*abs(chapeau_psi(t,sig)*y'); %calcul de l'integrale
end
end
a0=0.5; %on change de a0 pour pouvoir avoir une echelle encore plus petite
for i=1:5
a=a0^(i/20); %´echelle
%calcul des coefficients dondelettes a lechelle a
for b=0:length(x)-1
%On translate et on dilate l'ondelette
tmp=ones(1,length(x))*b;
t=(x-tmp)*a;
W(p-5+i,b+1)=(1/sqrt(a))*abs(chapeau_psi(t,sig)*y'); %calcul de l'integrale
end
end
% On trace
subplot(2,1,1);
plot(x,y);
title('fonction a analyser');
subplot(2,1,2);
imagesc(W(:,1:x(length(x))));
title('coefficients ondelette'); |
Partager