【发布时间】:2013-08-17 16:45:16
【问题描述】:
我正在尝试计算编辑文本框 (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 Image - 如您所见,它绘制了函数,但在尝试区分时返回 3 行数字:
【问题讨论】:
标签: matlab function user-interface plot derivative