I have a transfert function and I want to view if the system is stable by cheking its roots if their lenght is less than 1 but is does not go well and I don't understand where is the errorError in Untitled2ex42zabatawwalnoss (line 20)
x =
uicontrol('Parent',f1,'Style','text','Position',[81,1000,419,10],'value','systheme
instable'); %the vector after position specified the dimensions and location of the
slider
the hole code is
clear
close all
f1=figure; %f identifies the figure and will be used later
hold on
axis equal
axis([-10 10 -10 10])
%limits of x and y visible on the figure. Observe the figure and
g = uicontrol('Parent',f1,'Style','slider','Position',[81,50,1000,10],'value',0, 'min',-90,'max',90); %the vector after position specified the dimensions and location of the slider
m = uicontrol('Parent',f1,'Style','slider','Position',[81,23,1000,10],'value',0, 'min',-90,'max',90); %the vector after position specified the dimensions and location of the slider
l = uicontrol('Parent',f1,'Style','slider','Position',[81,10,1000,10],'value',0, 'min',-90,'max',90); %the vector after position specified the dimensions and location of the slider
q = uicontrol('Parent',f1,'Style','slider','Position',[81,0,1000,10],'value',0, 'min',-90,'max',90); %the vector after position specified the dimensions and location of the slider
x = uicontrol('Parent',f1,'Style','text','Position',[81,1000,419,10],'value','systheme instable'); %the vector after position specified the dimensions and location of the slider
while(1) %infinite loop
k=get(g,'value'); %reading the current value of the slider
uicontrol('Parent',f1,'Style','text','Position',[50,50,23,10],'String',num2str(k));
%displaying the value in the figure
a=get(m,'value'); %reading the current value of the slider
uicontrol('Parent',f1,'Style','text','Position',[50,23,23,10],'String',num2str(a));
b=get(l,'value'); %reading the current value of the slider
uicontrol('Parent',f1,'Style','text','Position',[50,10,23,10],'String',num2str(b));
c=get(q,'value'); %reading the current value of the slider
uicontrol('Parent',f1,'Style','text','Position',[50,0,23,10],'String',num2str(c));
p=get(g,'value'); %reading the current value of the slider
%displaying the value in the figure
s=zeros(1,12);
for j=3:10
s(j)=k*a^(-1)-b*a^(-1)*s(j-1)-c*a^(-1)*s(j-2);
end
h=plot([j,s]);
y=[a , b, c];
z=roots(y);
%ici on calcule la racine carree de la fonction de transfert
n= y/y(1) ;
%on rend le coefficient de x du plusgrand exposant egal a 1
c1= abs(n) ;
%o calcul le module de chaque racine
o= any(c1(:) >1);
%ici on compare le module de tout les t=racines ,si une %d’eux est superieure a 1 le systheme est %instable
if o>=1
uicontrol('Parent',f1,'Style','text','Position',[50,500,23,10]);
%displaying the value in the figure
end
pause(0.1) %waiting 0.1 seconds
delete(h);
delete(p);
end