Bisection Method GUI using Guide

조회 수: 12 (최근 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