0
我正在使用Matlab GUIDE在一條曲線中調整多個參數。我可以通過單個滑塊來調整單個參數,並修復所有其他參數,但我無法弄清楚或找到一種方法來從多個滑塊中獲取值以調整單個曲線。這裏是我的代碼到目前爲止:使用多個Matlab指南滑塊來調整曲線參數
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
By = get(handles.slider1,'Value');
Cy = 1.9;
Dy = 1;
Ey = 0.97;
ay = -15*pi/180:0.01:15*pi/180;
%alpha = -15:1:15;
Fy = (Dy*sin(Cy*atan((By*ay) - Ey*((By*ay) - atan(By*ay)))));
plot(handles.axes1,ay,Fy)
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
我也有相同的代碼爲第二個滑塊和軸的代碼。我正在繪製Fy vs ay,我想用滑塊調整參數Cy,Dy和Ey。我正在使用Matlab R2015a。
謝謝!