1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
Ki = get(handles.Valeur_Ki, 'String');
Kd = get(handles.Valeur_Kd, 'String');
Kp = get(handles.Valeur_Kp, 'String');
X=[1:4];
handles.Y{1}= sin(X+4);
handles.Y{2}= 2*X;
val = get(hObject,'Value');
switch val
%Fonction TOR
case 1
Ki=0;
set(handles.Valeur_Ki, 'Enable', 'off');
Kd=0;
set(handles.Valeur_Kd, 'Enable', 'off');
set(handles.Valeur_Kp, 'Enable', 'on');
handles.X=1;
%Fonction P
case 2
Ki=0;
set(handles.Valeur_Ki, 'Enable', 'on');
Kd=0;
set(handles.Valeur_Kd, 'Enable', 'off');
set(handles.Valeur_Kp, 'Enable', 'on');
Kp=get(handles.Valeur_Kp, 'double');
handles.X=2;
end
plot(handles.axes1,handles.Y{handles.X},'r');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Valeur_Kd_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function Valeur_Kd_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Valeur_Kp_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function Valeur_Kp_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Valeur_Ki_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function Valeur_Ki_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% --- Executes on button press in start.
function start_Callback(hObject, eventdata, handles) |
Partager