카테고리 없음2013. 4. 9. 22:25

clear all clear clc

 

rasio = 0.6; x = [1 7]; delx = [0.1 0.1]; tol = [0.001 0.001]; n=length(x); Fopt=fungsi(x(1),x(2)); xopt=x;F=Fopt; disp([xopt Fopt])


%checking delta


chekdel=strcat('if delx(1)<=tol(1)&delx(2)<=tol(2);','disp([xopt Fopt]);'...

    ,'disp(delx);','else;','del=delx*rasio;','delx=del;','eval(eksplorasi);'...

    ,'end;');


%repeating success step


ulsuk=strcat('while Fopt<F;','disp([xopt Fopt]);','for i=1:n;',... 

    'x(i)=xopt(i)+delx(i)*tanda(i);','end;','F=fungsi(x(1),x(2));',... 

    'if F<=Fopt;','xopt=x;', 'Fopt=F;','else;','break;','end;','end;',... 

    'eval(eksplorasi)');


%exploration:


eksplorasi=strcat('for ep=1:n;','tanda(ep)=0;','x(ep)=xopt(ep)+delx(ep);',... 

    'Fd=fungsi(x(1),x(2));','if Fd<=Fopt;','xopt(ep)=x(ep);','Fopt=Fd;','tanda(ep)=1;',... 

    'else;','x(ep)=xopt(ep)-delx(ep);','Fd=fungsi(x(1),x(2));','if Fd<=Fopt;',... 

    'xopt(ep)=x(ep);','Fopt=Fd;','tanda(ep)=-1;','end;','end;','end;','disp([xopt Fopt]);',... 

    'if abs(tanda(1))>0|abs(tanda(2))>0;','eval(ulsuk);','else;','eval(chekdel);',... 

    'end;'); eval(eksplorasi);




Posted by 오늘보다 나은 내일
카테고리 없음2013. 4. 6. 00:31

The handle structure for GUI created with GUIDE are stored in the figure object for the main GUI menu.

gui1fig = open('FirstGui.fig');
gui2fig = open('SecondGui.fig');

Then if the first GUI needs to reference a handle that exists in the second GUI,

handles2 = getappdata(gui2fig);

and access handles2.TheHandleName

If need be, the second handles structure can be updated from the first GUI by using

setappdata(gui2fig, handles2)

Posted by 오늘보다 나은 내일
카테고리 없음2013. 4. 3. 22:32

function [] = pb_call(varargin)

h = varargin{1}; % Get the caller's handle.

col = get(h,'backg');  % Get the background color of the figure.

set(h,'str','RUNNING...','backg',[1 .6 .6]) % Change color of button. 

% The pause (or drawnow) is necessary to make button changes appear.

% To see what this means, try doing this with the pause commented out.

pause(.01)  % FLUSH the event queue, drawnow would work too.

% Here is where you put whatever function calls or processes that the

% pushbutton is supposed to activate. 

% Next we simulate some running process.  Here just sort a vector.

A = rand(30000000,1);

A = sort(A); %#ok 

set(h,'str','Push Me','backg',col)  % Now reset the button features.

Posted by 오늘보다 나은 내일