Bisection Method GUI using Guide

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);

Réponses (1)

Adam
Adam le 25 Nov 2014

0 votes

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.

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Produits

Question posée :

Ben
le 25 Nov 2014

Réponse apportée :

le 25 Nov 2014

Community Treasure Hunt

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

Start Hunting!

Translated by