Hello. I'm working with a GUI and i don't how to introduce a function to be evaluate in my program. I started to use syms like a synonymous of inline, but i'm having problems with it. I hope you can help me. Note: I'm trying to solve a bisection method.
function BtnCalcular_Callback(hObject, eventdata, handles)syms x; Funcion=get(handles.EtxtFuncion,'String');A=str2double(get(handles.EtxtInterA,'String'));B=str2double(get(handles.EtxtInterB,'String'));Tol=str2double(get(handles.EtxtTol,'String'));e=100;while e>=Tol Xr=(A+B)/2; e=Xr-A; fXr=subs(Funcion,Xr); fXa=subs(Funcion,A); sig=(fXr)*(fXa); if sig>=0 A=Xr; else B=Xr; end endset(handles.ResRaiz,'String',num2str(A));
Best Answer