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
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
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
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
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
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