]> git.parisson.com Git - cnaq.git/commitdiff
* Fixed the RI horizontal scale
authoryomguy <yomguy@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Mon, 7 Apr 2008 14:59:09 +0000 (14:59 +0000)
committeryomguy <yomguy@5fc3e0e6-29bc-4d03-b52b-c088cb822bde>
Mon, 7 Apr 2008 14:59:09 +0000 (14:59 +0000)
* Load a .mat file properly

git-svn-id: http://svn.parisson.org/svn/CNAQ/trunk@170 5fc3e0e6-29bc-4d03-b52b-c088cb822bde

CNAQ.m
tools/RI_FT.m
tools/fonc_trans.m
tools/generator.m
tools/get_fs.m
tools/get_nbits.m
tools/measurement.m
tools/plot_main.m
tools/plot_mes.m
tools/set_fs.m
tools/set_nbits.m

diff --git a/CNAQ.m b/CNAQ.m
index c14dad14f3f575d86f38b5937fbe3997399267c7..f63438b940c9340e48eb48fe4a59a99ecc575d45 100644 (file)
--- a/CNAQ.m
+++ b/CNAQ.m
@@ -392,7 +392,7 @@ function save_button_Callback(hObject, eventdata, handles)
 function load_Callback(hObject, eventdata, handless)\r
 % hObject    handle to load (see GCBO)\r
 % eventdata  reserved - to be defined in a future version of MATLAB\r
-% handless    structure with handless and user data (see GUIDATA)\r
+% handles    structure with handles and user data (see GUIDATA)\r
     \r
     [filename, pathname, filterindex] = uigetfile('*.mat', 'Pick a saved MAT file');\r
     load([pathname filename]);\r
@@ -407,19 +407,17 @@ function load_Callback(hObject, eventdata, handless)
     set(handless.close_button,'UserData',f_lin);\r
     set(handless.mes_on,'UserData', f);\r
     set(handless.plot,'UserData', t);\r
-    set(handless.f_gen_min,'String', num2str(f_min));\r
-    set(handless.f_gen_max,'String', num2str(f_max));\r
-    set(handless.f_gen,'Value', f);\r
-    set(handless.freq_value,'String',num2str(f));\r
-    set(handless.time_gen,'Value', time);\r
-    set(handless.time_value,'String',num2str(time));\r
-    set(handless.gain_in,'Value', gain_in);\r
-    set(handless.gain_out,'Value', gain_out);\r
-    set(handless.gain_in_value,'String',num2str(gain_in));\r
-    set(handless.gain_out_value,'String',num2str(gain_out));\r
-    set(handless.freq_value,'String',num2str(f));\r
-    set(handless.time_value,'String',num2str(time));\r
-    set_fs(handless, f_s);\r
-    set_nbits(handless, nbits);\r
-    \r
+%      set(handles.f_gen_min,'String', num2str(f_min));\r
+%      set(handles.f_gen_max,'String', num2str(f_max));\r
+%      set(handles.f_gen,'Value', f);\r
+%      set(handles.freq_value,'String',num2str(f));\r
+%      set(handles.time_gen,'Value', time);\r
+%      set(handles.time_value,'String',num2str(time));\r
+%      set(handles.gain_in,'Value', gain_in);\r
+%      set(handles.gain_out,'Value', gain_out);\r
+%      set(handles.gain_in_value,'String',num2str(gain_in));\r
+%      set(handles.gain_out_value,'String',num2str(gain_out));\r
+%      set(handles.freq_value,'String',num2str(f));\r
+%      set(handles.time_value,'String',num2str(time));\r
+\r
 \r
index 33e81abcab164e9c40dfbcc1b0cdb5245d188e60..670577b2a141bc1b106b467b47946a23a441466e 100644 (file)
@@ -4,7 +4,7 @@ function [ri,ft]=RI_FT(f, sig_exc, sig_mes, f_s)
 \r
 % soustraction de la composante continue\r
 DC = mean(sig_mes,1);\r
-sig_mes = sig_mes - DC;\r
+%sig_mes = sig_mes - DC;\r
 len_f = length(f);\r
 f0 = f(1);\r
 f1 = f(len_f);\r
index 434d6c6e1ce4c7cb8d752826a1cf545d1d00439b..ec429bf8a9d9ca4b683ee33dee9e849d0863a4d1 100644 (file)
@@ -12,3 +12,4 @@ X = fft([sig_exc;zeros(len_f-1,1)]);
 Y = fft([zeros(len_f-1,1);sig_mes]);\r
 ft = Y./X;\r
 ri = real(ifft(ft))*f_s;\r
+%ri = [0; ri(1:length(ri)-1)];
\ No newline at end of file
index a8b76036bf5239080c4a4383dd930065551ec6c4..f2165a3294dece81e82fd2876b4acbef511c942e 100644 (file)
@@ -4,7 +4,10 @@ function generator(handles)
     f_max = str2double(get(handles.f_gen_max,'String'));
     sig_type = get(handles.sig_type,'Value');
     sin_freq = get(handles.f_gen,'Value');
-    f_s = get_fs(handles);
+    fs_id = get(handles.f_s,'Value');
+    nb_id = get(handles.nbits,'Value');
+    f_s = get_fs(fs_id);
+    nbits = get_nbits(nb_id);
     time = get(handles.time_gen,'Value');
     voices_out = get_voices_out(handles);
     %voice_first = voices_out(1);
index 07cd8a0fd5c493828535e5fb1d94d9b9afa7ae7a..41815d4a117ccf71681e8b249c0d38f0cf22a316 100644 (file)
@@ -1,6 +1,5 @@
-function f_s = get_fs(handles)
+function f_s = get_fs(fs_ind)
 
-    fs_ind = get(handles.f_s,'Value');
     if fs_ind == 1
         f_s = 44100;
     elseif fs_ind == 2
index e85ce0fe4cad7aa295a4c40fd0b1435df27478bd..8fae0f80710dc0170a5eca0bf3284b78a6b7b25c 100644 (file)
@@ -1,6 +1,5 @@
-function nbits = get_nbits(handles)
+function nbits = get_nbits(nb_ind)
 
-    nb_ind = get(handles.nbits,'Value');
     if nb_ind == 1
         nbits = 16;
     elseif nb_ind == 2
index ac13ef2b416ad9638e68a560e53b94ff4dcbcf0a..9be2f259e028a559407bcaef559436054b69bc81 100644 (file)
@@ -6,7 +6,10 @@ function measurement(handles)
     nfft = 32768;
     f_min = str2double(get(handles.f_gen_min,'String'));
     f_max = str2double(get(handles.f_gen_max,'String'));
-    f_s = get_fs(handles);
+    fs_id = get(handles.f_s,'Value');
+    nb_id = get(handles.nbits,'Value');
+    f_s = get_fs(fs_id);
+    nbits = get_nbits(nb_id);
     time = get(handles.time_gen,'Value');
     voices_in = get_voices_in(handles);
     voice_first = voices_in(1);
index e17f4ce620da69fe13cedc337b3fbcdf5ab49116..5c247ba5219f3c126bde3ebf77436bc4c5cade80 100644 (file)
@@ -7,7 +7,10 @@ function plot_main(handles)
     t = get(handles.plot,'UserData');
     f_min = str2double(get(handles.f_gen_min,'String'));
     f_max = str2double(get(handles.f_gen_max,'String'));
-    f_s = get_fs(handles);
+    fs_id = get(handles.f_s,'Value');
+    nb_id = get(handles.nbits,'Value');
+    f_s = get_fs(fs_id);
+    nbits = get_nbits(nb_id);
     size_sig_mes = size(sig_mes);
     n_col_sig_mes = size_sig_mes(2);
     
index 80c6fc48fd52712556b6c541765d0ded9f23bc91..0634c8f839c6001dca1aef9eda39b397689cf15c 100644 (file)
@@ -17,13 +17,11 @@ grid on;
 \r
 subplot(2,1,2);\r
 len_ri = length(rep_imp_mes);\r
-t_ri = [(-len_ri+1)/(2*f_s):1/f_s:len_ri/(2*f_s)];\r
+t_ri = [(-len_ri)/(2*f_s):1/f_s:(len_ri)/(2*f_s)];\r
 %t_ri = [0:1/f_s:len_ri/f_s];\r
 t_ri = t_ri(1:length(t_ri)-1);\r
-plot(t_ri, rep_imp_mes);\r
-%semilogx(t, sig_mes);\r
+plot(t_ri,rep_imp_mes);\r
 axis([-t_ri(len_ri) t_ri(len_ri) min(rep_imp_mes)-0.01 max(rep_imp_mes)+0.01]);\r
-%axis([1 t(length(t)) min(sig_mes)-0.01 max(sig_mes)+0.01]);\r
 xlabel('Temps (s)');\r
 ylabel('Amplitude');\r
 title(['RĂ©ponse impulsionnelle mesurĂ©e (groupe: ' group ', id: ' id ', voie : ' voice ')']);\r
index 61a1b970a81cd47c739becd66ed44552e929024e..fde87c1f02ee6d693ebb07318aad3dad702817f4 100644 (file)
@@ -1,4 +1,5 @@
-function set_fs(handles, f_s)
+function fs_ind = set_fs(f_s)
+% Return the id of the item in the sampling frequency list
 
     if f_s == 44100
         fs_ind = 1;
@@ -12,6 +13,4 @@ function set_fs(handles, f_s)
         fs_ind = 5;
     end
 
-    set(handles.f_s,'Value',fs_ind);
-
 end
\ No newline at end of file
index c8555ae6ff5f17840a1d366fff365642fe88c67f..e855dff8e645de43ff165a001a03ba9566e8ef98 100644 (file)
@@ -1,10 +1,9 @@
-function set_nbits(handles, nbits)
+function nb_ind = get_nbits_id(nbits)
 
     if nbits == 16
         nb_ind = 1;
     elseif nbits == 24
         nb_ind = 2;
     end
-    set(handles.nbits,'Value', nb_ind);
 
 end
\ No newline at end of file