我正在尝试计算编辑文本框(edit1)的导数并在静态文本框(text1)中显示答案。但它只是显示数字。我究竟做错了什么?
% --- Executes on button press in pushbutton1.
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)
x=-10:.1:10;
equation = get(handles.edit1, 'String');
y = eval(equation);
derive_func = diff(y);
set(handles.text1, 'String', derive_func);
plot(y);
GUI 图像- 如您所见,它绘制函数,但在尝试区分时返回 3 行数字: