1 | function [xfftamp,zfftamp,xfftphase,zfftphase,f_bpm]=fft_amp_phase_calcul(bufferX,bufferZ,fech) |
---|
2 | |
---|
3 | Nbpm=size(bufferX,1); |
---|
4 | Nsamples=size(bufferX,2); |
---|
5 | f_bpm=(1:Nsamples)*fech/Nsamples; |
---|
6 | |
---|
7 | % xfft(1:Nbpm,1:Nsamples)=0; |
---|
8 | % zfft(1:Nbpm,1:Nsamples)=0; |
---|
9 | |
---|
10 | % tic |
---|
11 | % for j=1:1:Nbpm |
---|
12 | % xfft(j,:)=fft(double(bufferX(j,:)))/Nsamples; |
---|
13 | % zfft(j,:)=fft(double(bufferZ(j,:)))/Nsamples; |
---|
14 | % xfftamp(j,:)=abs(xfft(j,:)); |
---|
15 | % zfftamp(j,:)=abs(zfft(j,:)); |
---|
16 | % xfftphase(j,:)=angle(xfft(j,:)); |
---|
17 | % zfftphase(j,:)=angle(zfft(j,:)); |
---|
18 | % |
---|
19 | % end |
---|
20 | % toc |
---|
21 | |
---|
22 | xfft2=fft(double(bufferX'))/Nsamples; |
---|
23 | zfft2=fft(double(bufferZ'))/Nsamples; |
---|
24 | xfftamp2=abs(xfft2); |
---|
25 | zfftamp2=abs(zfft2); |
---|
26 | xfftphase2=angle(xfft2); |
---|
27 | zfftphase2=angle(zfft2); |
---|
28 | |
---|
29 | xfftamp=xfftamp2(2:int32(Nsamples/2),:)'; |
---|
30 | zfftamp=zfftamp2(2:int32(Nsamples/2),:)'; |
---|
31 | xfftphase=xfftphase2(2:int32(Nsamples/2),:)'; |
---|
32 | zfftphase=zfftphase2(2:int32(Nsamples/2),:)'; |
---|
33 | |
---|
34 | % xfftamp=xfftamp(:,2:int32(Nsamples/2)); |
---|
35 | % zfftamp=zfftamp(:,2:int32(Nsamples/2)); |
---|
36 | % xfftphase=xfftphase(:,2:int32(Nsamples/2)); |
---|
37 | % zfftphase=zfftphase(:,2:int32(Nsamples/2)); |
---|
38 | f_bpm=f_bpm(2:int32(Nsamples/2)); |
---|
39 | |
---|
40 | |
---|