Bisection Method GUI using Guide

10 visualizaciones (últimos 30 días)
Ben
Ben el 25 de Nov. de 2014
Respondida: Adam el 25 de Nov. de 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);

Respuestas (1)

Adam
Adam el 25 de Nov. de 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.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by