From: yomguy Date: Fri, 4 Apr 2008 12:54:56 +0000 (+0000) Subject: * Fix length in temporal method X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8545f2da529e65dea9ec2e308a7a91d652037d16;p=cnaq.git * Fix length in temporal method * Fix spec git-svn-id: http://svn.parisson.org/svn/CNAQ/trunk@165 5fc3e0e6-29bc-4d03-b52b-c088cb822bde --- diff --git a/tools/RI_FT.m b/tools/RI_FT.m index ccdb3a9..140f68d 100644 --- a/tools/RI_FT.m +++ b/tools/RI_FT.m @@ -13,7 +13,7 @@ f1 = f(len_f); siginv=fliplr(sig_exc)./f; ft=fft([sig_mes; zeros(len_f-1,1)]).*fft([siginv; zeros(len_f-1,1)]); ri=real(ifft(ft)); -norm=sqrt(sum(abs(ri.^2))/siz); +norm=sqrt(sum(abs(ri.^2))/len_f); yeff=norm*sqrt(f_s/2/(f1-f0)); scal=f_s/yeff; ri=ri*scal; diff --git a/tools/get_ri_spec.m b/tools/get_ri_spec.m index ee15732..715bf11 100644 --- a/tools/get_ri_spec.m +++ b/tools/get_ri_spec.m @@ -1,6 +1,6 @@ -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); diff --git a/tools/plot_main.m b/tools/plot_main.m index e5c7ffe..d074330 100644 --- a/tools/plot_main.m +++ b/tools/plot_main.m @@ -16,7 +16,7 @@ function plot_main(handles) 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); @@ -27,7 +27,7 @@ function plot_main(handles) % 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