]> git.parisson.com Git - cnaq.git/commitdiff
Bugs fixed
authormanu <manu@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Mon, 7 Apr 2008 15:11:40 +0000 (15:11 +0000)
committermanu <manu@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Mon, 7 Apr 2008 15:11:40 +0000 (15:11 +0000)
git-svn-id: http://svn.parisson.org/svn/CNAQ/trunk@173 5fc3e0e6-29bc-4d03-b52b-c088cb822bde

tests/farina.m

index b6fabd94e4d998d1fd14e33882640ee5b5f41273..2f7c9a27a6bb4350efeefa37e82f7f5e26994447 100644 (file)
@@ -16,7 +16,7 @@ clear all
 close all\r
 %input parameters\r
 f1=1; % start frequency (Hz)\r
-f2=10000; %end frequency(Hz)\r
+f2=20000; %end frequency(Hz)\r
 tmax=.5; % excitation signal duration (s)\r
 nwin=100; % windowing point number (half at the begining - half at the end)\r
 \r
@@ -83,6 +83,7 @@ IRT=exp(-t2/RC)/RC;
 IRT(1:siz-1)=0;\r
 hold on \r
 plot(t2,IRT,'r')\r
+legend('Processed','Theory',3)\r
 \r
 % frequency response : Inverse filter deconvolution (time domain)\r
 FR=fft(IR)/fs;\r
@@ -103,6 +104,11 @@ LFRT=20*log10(FRT);
 semilogx(fconv,LFRT,'r')\r
 xlabel('Frequency (Hz)')\r
 legend('Processed','Theory',3)\r
+imin=round(f1/fs*sizi)+1;\r
+imax=round(f2/fs*sizi)+1;\r
+E1=sqrt(sum(abs(FRT(imin:imax)-FR(imin:imax)).^2./(abs(FRT(imin:imax)).^2)))*100/(imax-imin+1);\r
+E1t = strcat('Erreur quadratique :',num2str(E1,2),' %');\r
+text(3000,-5,E1t);\r
 \r
 %Transfer function method\r
 specy=fft(y);\r
@@ -111,17 +117,17 @@ TF=specyf./specy;
 IR2=ifft(TF)*fs;\r
 figure(2)\r
 subplot(3,1,2)\r
-pad=zeros(1,siz-1);\r
-IR2=[pad IR2];\r
-plot(t2,IR2,'b')\r
+pad=zeros(1,siz-1);\r
+IR2=[pad IR2];\r
+plot(t,IR2,'b')\r
 grid on\r
 hold on \r
 plot(t2,IRT,'r')\r
 xlabel('samples')\r
 ylabel('Inverse Transfer Function')\r
+legend('Processed','Theory',3)\r
 TF2=TF(1:siz/2);\r
-f=0:fs/siz:fs/2;\r
-f=f(1:siz/2);\r
+f=0:fs/siz:fs/2-fs/siz;\r
 LFR2=20*log10(abs(TF2));\r
 figure(3)\r
 subplot(3,1,2)\r
@@ -135,6 +141,11 @@ semilogx(f,LFRT2,'r')
 xlabel('Frequency (Hz)')\r
 ylabel('Transfer Function')\r
 legend('Processed','Theory',3)\r
+% imin=round(f1/fs*sizi)+1;\r
+% imax=round(f2/fs*sizi)+1;\r
+% E2=sqrt(sum(abs(FRT(imin:imax)-TF2(imin:imax)).^2./(abs(FRT(imin:imax)).^2)))*100/(imax-imin+1);\r
+% E2t = strcat('Erreur quadratique :',num2str(E2,2),' %');\r
+% text(3000,-5,E2t);\r
 \r
 % Impulse response: Inverse filter deconvolution (freq domain)\r
 % yinv=fliplr(yc);\r
@@ -161,6 +172,7 @@ IRT=exp(-t2/RC)/RC;
 IRT(1:siz-1)=0;\r
 hold on \r
 plot(t2,IRT,'r')\r
+legend('Processed','Theory',3)\r
 \r
 % frequency response : Inverse filter deconvolution (freq domain)\r
 FR3=iRF(1:sizi/2);\r