siginv=fliplr(sig_exc)./f;\r
ft=fft([sig_mes; zeros(len_f-1,1)]).*fft([siginv; zeros(len_f-1,1)]);\r
ri=real(ifft(ft));\r
-norm=sqrt(sum(abs(ri.^2))/siz);\r
+norm=sqrt(sum(abs(ri.^2))/len_f);\r
yeff=norm*sqrt(f_s/2/(f1-f0));\r
scal=f_s/yeff;\r
ri=ri*scal;\r
-function [ri, spec] = get_spec_ri(f, sig_exc, sig_mes, f_s)
+function [ri, spec] = get_spec_ri(f, sig_exc, sig_mes, f_s, mes_type)
% Return the impulse response and the spectrum compute with the given method
-
+
if mes_type == 1
% Frequency method
[ri, spec] = fonc_trans(f, sig_exc, sig_mes);
mes_type = get(handles.mes_type,'Value');
% Compute excitation spectrum
- [rep_imp_exc, spec_exc] = get_ri_spec(f, sig_exc, sig_exc, f_s);
+ [rep_imp_exc, spec_exc] = get_ri_spec(f, sig_exc, sig_exc, f_s, mes_type);
len_spec_exc = length(spec_exc);
spec_exc = spec_exc(1:len_spec_exc/2);
% Compute all Ris and specs
for i=1:n_col_sig_mes
voice = num2str(i);
- [rep_imp_mes, spec_mes] = get_ri_spec(f, sig_exc, sig_mes(:,i), f_s);
+ [rep_imp_mes, spec_mes] = get_ri_spec(f, sig_exc, sig_mes(:,i), f_s, mes_type);
len_spec_mes = length(spec_mes);
spec_mes = spec_mes(1:len_spec_mes/2);
% Plot results