% they wish to analyse for root locus plot. This may show the basis locus
% plot of Kind 0,1 or 2 system as per the selection of the consumer after which with
% the chosen level on the graph, it would return the worth of ok, poles,
% part margin, acquire margin, part crossover and acquire crossover
%%
% Creator: Ayush Sengupta, MATLAB Helper
% Subject: Root locus utilizing MATLAB
% Web site: https://MATLABHelper.com
% Date:14/05/2022
% MATLAB Model & Toolbox used: MATLAB Model R2021a and Management System Toolbox
clc;
clear;
shut all;
fprintf(‘ 0: Evaluation of Kind 0 Systemn 1: Evaluation of Kind 1 Systemn’);
fprintf(‘ 2: Evaluation of Kind 2 Systemn’)
x=enter(‘Which Kind of System you wish to test: ‘);
swap x
%for root locus of Kind 0 system
case 0
numerator = 1;
denominator = [1 1];
g=tf(numerator, denominator);
rlocus(g)
[k, p]=rlocfind(g);
[GM, PM, GCF, PCF] = margin(g);
case 1
%for root locus of Kind 1 system
numerator = 1;
denominator = [1 1 0];
g=tf(numerator, denominator);
rlocus(g)
[k, p]=rlocfind(g);
[GM, PM, GCF, PCF] = margin(g);
case 2
%for root locus of Kind 2 system
numerator = 1;
denominator = [1 1 0 0];
g=tf(numerator, denominator);
rlocus(g)
[k, p]=rlocfind(g);
[GM, PM, GCF, PCF] = margin(g);
in any other case
disp(“Invalid enter”)
finish
fprintf(‘ System Evaluation is over. Listed below are the parameters:n’);
fprintf(‘ The worth of ok is:n’ );
disp(ok);
fprintf(‘ The situation of closed loop poles are:n’);
disp(p);
fprintf(‘ The acquire margin of the system is:n’);
disp(GM);
fprintf(‘ The part margin of the system is:n’);
disp(PM)
fprintf(‘ The acquire crossover of the system is:n’);
disp(GCF);
fprintf(‘ The part crossover of the system is:n’);
disp(PCF);