function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
syms x a b m n;
a = str2num(get(handles.edit1,'String'));
b = str2num(get(handles.edit2,'String'));
% a and b are variables of Strings type, and need to be converted
% to variables of Number type before they can be added together
dx=0.01;x=a:dx:b;
m = str2num(get(handles.edit3,'String'));
n = str2num(get(handles.edit4,'String'));
f = m*x+n;
c= int(f,x,a,b);
set(handles.text5,'String',c);
plot(x,f,'r'),title('311622001002'); %加图形标题。
grid on;
xlabel('X'); ylabel('Y');
legend('y1','y2');
guidata(hObject, handles);
函数的定积分与图像的保存
任务及指标
(1)设计GUI界面;
(2)由用户在文本框中输入关于x的一维函数表达式;
(3)由用户在文本框中输入积分上限和下限;
(4)当用户点击计算按钮后,在GUI界面中画出该一维函数的图像(可以采用坐标轴对象实现),并显示积分结果。
(5)当用户点击保存按钮后,保存该函数图像。