Hello, I would like to ask help to solve the parametric inequality coming out after applying the Routh Hurwitz criterion and plot the the solution as in the picture.

2 次查看(过去 30 天)
The problem is that i cannot find a similar command "isolate" for inequalities, i would like to plot the solutions of the variable a,b as in the picture. THe code is the following, i just need a few lines more to complete but i dont have ideas anymore. THanks
clc
clear all
syms a b
D= [1+b+a, 2*(1-b), -a+1+b]; % parametric polynomial (1+b+a)s^2+2*(1-b)*s+-a+1+b
l=length(D)
l = 3
syms m
if mod(l,2)==0
m=sym(zeros(l,l/2));
[cols,rows]=size(m);
for i=1:rows
m(1,i)=D(1,(2*i)-1);
m(2,i)=D(1,(2*i));
end
else
m=sym(zeros(l,(l+1)/2));
[cols,rows]=size(m);
for i=1:rows
m(1,i)=D(1,(2*i)-1);
end
for i=1:((l-1)/2)
m(2,i)=D(1,(2*i));
end
end
for j=3:cols
if m(j-1,1)==0
m(j-1,1)=0.001;
end
for i=1:rows-1
m(j,i)=(-1/m(j-1,1))*det([m(j-2,1) m(j-2,i+1);m(j-1,1) m(j-1,i+1)]);
end
end
disp('--------The Routh-Hurwitz array is:--------'), simplify(m)
--------The Routh-Hurwitz array is:--------
ans = 
% --------------------End of Bulding array--------------------------------
%{
% Checking for sign change
Temp=sign(m);a=0;
for j=1:cols
a=a+Temp(j,1);
end
if a==cols
disp(' ----> System is Stable <----')
else
disp(' ----> System is Unstable <----')
end
%}
h=m(:,1);
for i=1:1:length(h)
isolate(h(i)==0,b)
end
ans = 
ans = 
ans = 

采纳的回答

Aishwarya
Aishwarya 2023-10-31
Hi,
I understand that you are looking to plot the inequalities obtained through your code in order to resemble the graph shown in the question. After reviewing the above code, I have provided an example code that will plot the inequalities and achieve the desired graph.
a = -5:0.01:5;
b = -5:0.01:5;
% Create 2-D grid coordinates
[A, B] = meshgrid(a,b);
% Create a 2-D grid which satisfy the inequalities
ineq = (B > -A - 1) & (B < 1) & (B > A - 1);
% Plot the points which satisfy equations
ineq = double(ineq);
ineq(ineq==0) = NaN;
h = pcolor(A,B,double(ineq));
h.EdgeColor = 'none';
grid on
Please refer to the MathWorks documentations below for more information about the functions used:
I hope this helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by