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
|
%%%% LECUTURE DES DEUX VOIES
fseek(fid,premiere,'bof');
voie1 = fread(fid,n,'int16');
fseek(fid,premiere+decalage,'bof');
voie2 = fread(fid,n,'int16');
%%%% SPECTRE
voie1_fft = fft(voie1,n);
voie2_fft = fft(voie2,n);
% normalisation
voie1_fft = abs(voie1_fft)/n ;
voie2_fft = abs(voie2_fft)/n ;
freq_ech = 10000;
f=(1:n-1)/n*freq_ech;
freq_plot = f(1:n/2)';
v1_spect = voie1_fft(1:n/2)/2 ;
v2_spect = voie2_fft(1:n/2)/2;
bande_freq=[] ;
bande_freq(1)=4999 ;
for i=2:22
bande_freq(i) = bande_freq(i-1)/(2^(1/3));
end
nc=21;
for j = 1:nc
freq_plot_pas{j} = freq_plot(freq_plot>bande_freq(i+1) & freq_plot<=bande_freq(i));
v1_spect_pas{j} = v1_spect(freq_plot>bande_freq(i+1) & freq_plot<=bande_freq(i));
end
couleurs=hsv(nc);
for j=1:nc
hold on
plot(freq_plot_pas{j},v1_spect_pas{j},'color',couleurs(j,:));
hold off
end |
Partager