# To determine the stability of a LTI system with a two-sided impulse response has the difference equation model

8 views (last 30 days)
William on 21 Sep 2021
I am trying to determine the stability of the following system: . The following is my code:
My question is: In my code, I can only enter a single value for λ. Is there a way to express λ as a vector which contains multiple values and thus, I can prove the stability of the system with different λ simultaneously?
function stable(k)
b = [0 0 k 0 0];
a = [1 -4 k+6 -4 1];
zplane(b,a);
p = roots(a);
pm = roundn(abs(p),-4);
if max(pm)>1 %double-sided
disp('System is stable');
else
disp('System is not stable');
end
##### 2 CommentsShowHide 1 older comment
Paul on 21 Sep 2021
What is meant by "two-sided impulse response"?

Hi,
I understand that you are trying to check the stability of the given system for different values of lamda.
You can obtain the same by having an input vector containing the values of lamda. You may use a for loop to call the function you have written , for each value in the input vector lamda.
If you do not want to have a function call for each value in the input vector, you can vectorize the whole function. The following code might help for the given system, assuming that the number of lamda values used are 6.
l=[1,2,3,4,5,6]'; %l is containing the lamda values and the number of lamda values used here are 6.
b=zeros(6,5);
b(:,3)=-1*l;
a=[1,-4,6,-4,1];
a=repmat(a,6,1);
a(:,3)=a(:,3)+l(:);
for i = 1:6
p(i,:)=roots(a(i,:));
p(i,:)=roundn(abs(p(i,:)),-4);
end
output=max(p,[],2)>1;
Alternatively, you can directly use the 'isstable' function in matlab to get the stability of all transfer functions simultaneously , by passing a model array to the function. You may refer to the documentation to get a better idea on it.

R2020b

### Community Treasure Hunt

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

Start Hunting!