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。
谢谢!