Code covered by the BSD License  

Highlights from
GUI for Routh-Hurwitz Criterion

image thumbnail
from GUI for Routh-Hurwitz Criterion by xianfa zeng
Input commands in the edit text, and it will compute and display the Routh-Hurwitz array.

disp_result(str_input)
function disp_result(str_input)
% 
% call routh.m to compute the Routh-Hurwitz array and diaplay the results
% using cell array.
% 
hok = findobj(gcf,'tag','ok');
set(hok,'enable','off');
houtput = findobj(gcf,'tag','output');
str(1) = {'The input vector is:'};
str(2) = {str_input};
str(3) = {'---------------------------------------------------------------------'};
set(houtput,'string',str);
str(4) = {'Routh-Hurwitz array:'};
pause(1);
poli = funct(); 
syms e;
[RA,s_o] = routh(poli,e); 
[m,n] = size(RA);
str_row = '';
for i = 1:m
    for j = 1:n
        if j ~= n
            tmp = char(RA(i,j)); 
            str_row = [str_row,tmp,'                     '];
        else
            tmp = char(RA(i,j));
            str_row = [str_row,tmp];
        end
    end
    tmp1 = sprintf('s^%d',m-i);
    tmp1 = [tmp1,'    |           ',str_row];
    str(i+4) = {tmp1};
    str_row = '';
end
str(m+4+1) = {'---------------------------------------------------------------------'};
str(m+4+2) = {s_o};
houtput = findobj(gcf,'tag','output');
set(houtput,'string',str);
set(hok,'enable','on');

Contact us at files@mathworks.com