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
| clear
close all
load('data_valeur.mat')
[N_time,N_data]=size(data);
NFFT=2^nextpow2(N_time+1);
fs=1/0.0069; %en 1/jour ici le pas entre chaque deux mesures est 10 min et on a transformée cette durée en jour.
freq=linspace(0,1,NFFT/2)*fs/2;
v=zeros(length(freq),N);
% transformée de Fourier
for i=1:N1
rgb=rand(1,3);
tmp=fft(d1(:,i),NFFT);
spectrum=tmp.*conj(tmp);
spectrum=spectrum/max(spectrum(:));
v(:,i)=spectrum(1:length(freq));
v(:,i)=abs(v(:,i));
figure(50),
hold on
plot(a,v(:,i),'color',rgb)
hold off
end
% corrélation
for i=1:N1
for j=i+1:N1
FFT_i=fft(d1(:,i)-mean(d1(:,i)),NFFT);
FFT_j=fft(d1(:,j)-mean(d1(:,j)),NFFT);
correl=fftshift(ifft(FFT_i.*conj(FFT_j)))/(sqrt(sum(FFT_i.*conj(FFT_i)))*sqrt(sum(FFT_j.*conj(FFT_j))));
rgb=rand(1,3);
figure(65),
hold on
plot(correl,'color',rgb);
hold off
end
end |
Partager