Bonjour

Je suis en train de programmer l'algorithme de transformée par ondelettes. J'ai trouvé un code sur le net mais il est en python et j'aimerai avoir l'équivalent en Matlab. Voici le code python
Code Python : Sélectionner tout - Visualiser dans une fenêtre à part
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
from scipy.io.wavfile import read
from pylab import *
import matplotlib.pyplot as plt
import numpy as np
import scipy
 
# read the file                              
(sr, samples) = read('test.wav')    
x = (np.float32(samples)/((2 ** 15)-1))
N = len(x)
x_fft = np.fft.fft(x)
 
# scales
J = 200    
scales = np.asarray([2**(i * 0.1) for i in range(J)])
 
# pre-compute the Fourier transform of the Morlet wavelet 
morletft = np.zeros((J, N))
for i in range(J):
  morletft[i][:N/2] = sqrt(2 * pi * scales[i]) * exp(-(scales[i] * 2 * pi * scipy.array(range(N/2)) / N - 2)**2 / 2.0)
 
# compute the CWT 
X = empty((J, N), dtype=complex128)
for i in range(J):
  X[i] = np.fft.ifft(x_fft * morletft[i])

Dans ce code, on calcule la tranformée en ondelette en utilisant une convolution. Pour faciliter l'opération, on passe par la transformée de fourier. Pour simplifier, j'ai pris scales=1. Et j'aimerai un code matlab du passage "pre compute the fourier transform" jusqu'à la fin.


Merci