Bisection Method GUI using Guide

2 views (last 30 days)
Ben
Ben on 25 Nov 2014
Answered: Adam on 25 Nov 2014
Below is a section of my code for a GUI that takes an equation and solves in using the code provided for the bisection method. But when I hit calculate it outputs the function instead of the solution. Any advice on how to get this working. Also this section of the code in under the calculate callback in my code.
itr=get(findobj('tag','iter'),'string');
xl=get(findobj('tag','lower'),'string');
xu=(get(findobj('tag','upper'),'string'));
f= @(x)(get(findobj('tag','func'),'string'));
xr0=0;
i=1:itr
fxl=f(xl);
fxu=f(xu);
xr=(xl+xu)/2;
fxr= f(xr);
set(findobj('tag','root'),'string',fxr);

Answers (1)

Adam
Adam on 25 Nov 2014
The only thing I can see that that would output is:
i = 1:itr
One thing that does strike me as odd though - why does your f take an argument, x, but not use it?
From what I can tell your calls to 'f' will always return the string of the same object with tag 'func', if such a GUI handle exists so fx1, fxu and fxr will all be the same string.

Categories

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

Products

Community Treasure Hunt

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

Start Hunting!