Symbolic Differentiation in GUIDE using MATLAB

1 view (last 30 days)
I'm using GUIDE in MATLAB R2013b to make an application that takes an expression in a text box (edit1), and shows the derivate in a static text (text2). Here's my code:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(~, ~, 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')
equation = get(handles.edit1, 'String');
y = eval(equation);
set(handles.text2, 'String', char(diff(y)));
It isn't working, however. I get the bell sound (in Windows 7) when the button is pressed. What's wrong?

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!