\r
% Author: Guillaume Pellerin <guillaume.pellerin@cnam.fr>\r
\r
-% Last Modified by GUIDE v2.5 08-Apr-2008 18:19:43\r
+% Last Modified by GUIDE v2.5 21-Nov-2008 10:49:08\r
\r
% CNAQ, by itself, creates a new CNAQ or raises the existing\r
% singleton*.\r
set(handles.channels_in,'String','1|1 2|1 2 3|1 2 3 4|1 2 3 4 5 6 7 8');\r
set(handles.channels_out,'String','1|1 2|1 2 3|1 2 3 4|1 2 3 4 5 6 7 8');\r
\r
-set(handles.analysis_type,'String','Default');\r
+set(handles.analysis_type,'String','Transfer function|Impedance');\r
set(handles.analysis_method,'String','Division|Deconvolution');\r
set(handles.analysis_domain,'String','Frequency|Time|Time/Frequency');\r
set(handles.in_on_off,'UserData',device);\r
set(handles.save_button,'UserData',latency);\r
\r
- \r
+set(handles.analysis_input_sig,'String','Generated|Measured');\r
+set(handles.analysis_output_sig,'String','Measured|Generated');\r
+set(handles.analysis_input_ch,'String','1|2|3|4|5|6|7|8');\r
+set(handles.analysis_output_ch,'String','1|2|3|4|5|6|7|8');\r
+\r
%============================================\r
% DATA\r
%============================================\r
end\r
\r
\r
+function r_c_Callback(hObject, eventdata, handles)\r
+% hObject handle to r_c (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles structure with handles and user data (see GUIDATA)\r
+\r
+% Hints: get(hObject,'String') returns contents of r_c as text\r
+% str2double(get(hObject,'String')) returns contents of r_c as a double\r
+\r
+\r
+% --- Executes during object creation, after setting all properties.\r
+function r_c_CreateFcn(hObject, eventdata, handles)\r
+% hObject handle to r_c (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles empty - handles not created until after all CreateFcns called\r
+\r
+% Hint: edit controls usually have a white background on Windows.\r
+% See ISPC and COMPUTER.\r
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))\r
+ set(hObject,'BackgroundColor','white');\r
+end\r
+\r
+\r
+\r
+\r
+% --- Executes on selection change in analysis_output_sig.\r
+function analysis_output_sig_Callback(hObject, eventdata, handles)\r
+% hObject handle to analysis_output_sig (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles structure with handles and user data (see GUIDATA)\r
+\r
+% Hints: contents = get(hObject,'String') returns analysis_output_sig contents as cell array\r
+% contents{get(hObject,'Value')} returns selected item from analysis_output_sig\r
+\r
+\r
+% --- Executes during object creation, after setting all properties.\r
+function analysis_output_sig_CreateFcn(hObject, eventdata, handles)\r
+% hObject handle to analysis_output_sig (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles empty - handles not created until after all CreateFcns called\r
+\r
+% Hint: popupmenu controls usually have a white background on Windows.\r
+% See ISPC and COMPUTER.\r
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))\r
+ set(hObject,'BackgroundColor','white');\r
+end\r
+\r
+\r
+% --- Executes on selection change in analysis_output_ch.\r
+function analysis_output_ch_Callback(hObject, eventdata, handles)\r
+% hObject handle to analysis_output_ch (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles structure with handles and user data (see GUIDATA)\r
+\r
+% Hints: contents = get(hObject,'String') returns analysis_output_ch contents as cell array\r
+% contents{get(hObject,'Value')} returns selected item from analysis_output_ch\r
+\r
+\r
+% --- Executes during object creation, after setting all properties.\r
+function analysis_output_ch_CreateFcn(hObject, eventdata, handles)\r
+% hObject handle to analysis_output_ch (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles empty - handles not created until after all CreateFcns called\r
+\r
+% Hint: popupmenu controls usually have a white background on Windows.\r
+% See ISPC and COMPUTER.\r
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))\r
+ set(hObject,'BackgroundColor','white');\r
+end\r
+\r
+\r
+% --- Executes on selection change in analysis_input_sig.\r
+function analysis_input_sig_Callback(hObject, eventdata, handles)\r
+% hObject handle to analysis_input_sig (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles structure with handles and user data (see GUIDATA)\r
+\r
+% Hints: contents = get(hObject,'String') returns analysis_input_sig contents as cell array\r
+% contents{get(hObject,'Value')} returns selected item from analysis_input_sig\r
+\r
+\r
+% --- Executes during object creation, after setting all properties.\r
+function analysis_input_sig_CreateFcn(hObject, eventdata, handles)\r
+% hObject handle to analysis_input_sig (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles empty - handles not created until after all CreateFcns called\r
+\r
+% Hint: popupmenu controls usually have a white background on Windows.\r
+% See ISPC and COMPUTER.\r
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))\r
+ set(hObject,'BackgroundColor','white');\r
+end\r
+\r
+\r
+% --- Executes on selection change in analysis_input_ch.\r
+function analysis_input_ch_Callback(hObject, eventdata, handles)\r
+% hObject handle to analysis_input_ch (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles structure with handles and user data (see GUIDATA)\r
+\r
+% Hints: contents = get(hObject,'String') returns analysis_input_ch contents as cell array\r
+% contents{get(hObject,'Value')} returns selected item from analysis_input_ch\r
+\r
+\r
+% --- Executes during object creation, after setting all properties.\r
+function analysis_input_ch_CreateFcn(hObject, eventdata, handles)\r
+% hObject handle to analysis_input_ch (see GCBO)\r
+% eventdata reserved - to be defined in a future version of MATLAB\r
+% handles empty - handles not created until after all CreateFcns called\r
+\r
+% Hint: popupmenu controls usually have a white background on Windows.\r
+% See ISPC and COMPUTER.\r
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))\r
+ set(hObject,'BackgroundColor','white');\r
+end\r
+\r
+\r
type = get(handles.analysis_type,'Value');
method = get(handles.analysis_method,'Value');
domain = get(handles.analysis_domain,'Value');
-
- % Compute excitation spectrum
- [rep_imp_exc, spec_exc] = get_ri_spec(f, sig_exc, sig_exc, f_s, method);
- len_spec_exc = length(spec_exc);
- spec_exc = spec_exc(1:len_spec_exc/2);
+ analysis_input_sig = get(handles.analysis_input_sig,'Value');
+ 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');
+
+ if analysis_input_sig == 1
+ input_sig = sig_exc;
+ elseif analysis_input_sig == 2
+ input_sig = sig_mes;
+ end
+ if analysis_output_sig == 2
+ output_sig = sig_exc;
+ elseif analysis_output_sig == 1
+ output_sig = sig_mes;
+ end
+
+ if type == 1
+ % Transfer function
- % Compute all Ris and specs
- for i=1:n_col_sig_mes
- channel = num2str(i);
- [rep_imp_mes, spec_mes] = get_ri_spec(f, sig_exc, sig_mes(:,i), 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, sig_exc, sig_mes(:,i), rep_imp_mes, spec_mes, spec_exc, id, channel, username, comment, i, domain);
+ % Compute excitation spectrum
+ [rep_imp_exc, spec_exc] = get_ri_spec(f, sig_exc, sig_exc, f_s, method);
+ 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
+ channel = num2str(i);
+ [rep_imp_mes, spec_mes] = get_ri_spec(f, input_sig, output_sig(:,i), 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
end
- set(handles.close_button,'UserData',f_lin');
+ if type == 2
+ % Impedance
+ plot_impedance(sig_mes, r_c)
+ end
+
+ set(handles.close_button,'UserData','f_lin');
set(handles.plot,'UserData',t);
end