Bisection Method GUI using Guide

10 次查看(过去 30 天)
Ben
Ben 2014-11-25
回答: Adam 2014-11-25
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);

回答(1 个)

Adam
Adam 2014-11-25
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by