From 9d9aa7c1449023f5070659e906cffd8711cc0204 Mon Sep 17 00:00:00 2001 From: yomguy Date: Fri, 21 Nov 2008 13:09:12 +0000 Subject: [PATCH] Fix impedance git-svn-id: http://svn.parisson.org/svn/CNAQ/trunk@204 5fc3e0e6-29bc-4d03-b52b-c088cb822bde --- tools/plot_impedance.m | 4 ++-- tools/plot_main.m | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/plot_impedance.m b/tools/plot_impedance.m index af1f013..e321609 100644 --- a/tools/plot_impedance.m +++ b/tools/plot_impedance.m @@ -1,7 +1,7 @@ % Loudspeaker impedance post-processing from a 2 voice acquisition from CNAQ % Copyright (C) Guillaume Pellerin -function plot_impedance(sig_mes, R_c, option) +function plot_impedance(sig_mes, R_c, f_s, f_min, f_max, option) % fic_resistance : the (CNAQ) MAT file containing the transfert function of the % resistance @@ -13,7 +13,7 @@ function plot_impedance(sig_mes, R_c, option) %load(fic_mes); U_r = sig_mes(:,1); -I_r = sig_mes(:,1)/R_c; +I_r = sig_mes(:,1)./R_c; U_hp = sig_mes(:,2)-U_r; %i = sig_mes(:,1); diff --git a/tools/plot_main.m b/tools/plot_main.m index 34803c8..a25cb98 100644 --- a/tools/plot_main.m +++ b/tools/plot_main.m @@ -25,7 +25,7 @@ function plot_main(handles) analysis_output_sig = get(handles.analysis_output_sig,'Value'); analysis_input_ch = get(handles.analysis_input_ch,'Value'); analysis_output_ch = get(handles.analysis_output_ch,'Value'); - r_c = get(handles.r_c,'Value'); + r_c = str2double(get(handles.r_c,'String')); if analysis_input_sig == 1 input_sig = sig_exc; @@ -47,21 +47,21 @@ function plot_main(handles) spec_exc = spec_exc(1:len_spec_exc/2); % Compute all Ris and specs - for i=1:n_col_sig_mes + %for i=1:n_col_sig_mes channel = num2str(i); - [rep_imp_mes, spec_mes] = get_ri_spec(f, input_sig, output_sig(:,i), f_s, method); + [rep_imp_mes, spec_mes] = get_ri_spec(f, input_sig(:,analysis_input_ch), output_sig(:,analysis_output_ch), f_s, method); len_spec_mes = length(spec_mes); spec_mes = spec_mes(1:len_spec_mes/2); % Plot results f_lin = [0:f_s/len_spec_mes:f_s/2]; f_lin = f_lin(1:length(f_lin)-1); - plot_mes(t, f_lin, f_s, f_min, f_max, input_sig, output_sig(:,i), rep_imp_mes, spec_mes, spec_exc, id, channel, username, comment, i, domain); - end + plot_mes(t, f_lin, f_s, f_min, f_max, input_sig(:,analysis_input_ch), output_sig(:,analysis_output_ch), rep_imp_mes, spec_mes, spec_exc, id, channel, username, comment, i, domain); + %end end if type == 2 % Impedance - plot_impedance(sig_mes, r_c) + plot_impedance(output_sig, r_c, f_s, f_min, f_max, 'log'); end set(handles.close_button,'UserData','f_lin'); -- 2.39.5