Help with root locus homework1

118
-1

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
118
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Help with root locus homework1

  1. 1. ROOT LOCUS (SAMPLE ASSIGNMENT) Our online Tutors are available 24*7 to provide Help with Root Locus Homework/Assignment or a long term Graduate/Undergraduate Root Locus Project. Our Tutors being experienced and proficient in Root Locus ensure to provide high quality Root Locus Homework Help. Upload your Root Locus Assignment at ‘Submit Your Assignment’ button or email it to . You can use our ‘Live Chat’ option to schedule an Online Tutoring session with our Root Locus Tutors. Routh Hurwitz Criterion RouthHurwitzCriterion.m % PROGRAM BY ASUTOSH MISHRA % clc; close all; clear all; y1 = input('Press "y" and "Enter" to Start The Program:: ','s'); disp(' '); if (y1~='y') errordlg('**Please Type "y" to continue Else The Program Will Terminate**','Caution'); y1 = input('Press "y" and Enter to Continue:: ','s'); end if (y1~='y') disp(' '); disp('Program Terminates'); end y2 = y1; y3 = y1; clc; while (y1=='y') && (y2=='y') if (y3~='y') clc; end disp('~:~:~:~:~:~:~:~:~:~ROUTH HURWITZ CRITERION~:~:~:~:~:~:~:~:~:~'); disp(' '); disp(' Stability Analysis Using Characteristic Equation '); disp(' '); if (y1=='y'); clear a b c D1 D2 G G1 G2 H i I k K L1 L2 m n P P1 P2 Q r R R1 R2 R3 Z Z1; disp('~:~:Analysis Using Characteristic Equation:~:~'); disp(' '); helpdlg(sprintf('--> The Charateristic Equation Is " a(0) * x^n + a(1) * x^(n-1) + ... + a(n)" n--> a(0) , a(1) , a(2) ... are coefficients n--> If n is odd then Even Power Coefficients are :: a(1) , a(2) , a(3) ... a(n-1) n--> If n is even then the Even Power Coefficients are :: a(0) , info@assignmentpedia.com
  2. 2. a(2) , ... a(n) n--> Give The values of all the Coefficients(Even if they are "0") n'),'Note On Entering Input'); a = input('Even Power Coefficients in decreasing order of power of "x"(Ex. Within []) :: '); b = input('Odd Power Coefficients in decreasing order of power of "x"(Ex. Within []) :: '); disp(' '); digits(5) L1 = length(a); L2 = length(b); disp(['No. Of The Roots:: ',num2str(L1+L2-1)]); disp(' '); disp('~:~:~:~:~:~:~:~:~:~:~:~Routh Array~:~:~:~:~:~:~:~:~:~:~:~'); if (L2>L1) P = 0; P1 = 0; P2 = 0; Z = zeros(1,(L2-L1)); R = horzcat(a,Z); Z1 = horzcat(a,Z); R1 = b; disp(vpa(b)); disp(vpa(Z1)); H = 1; for n = 1:(L2+L1-2) R2 = R; for m = 1:(L2-1) if (R2(1,1)~=0) if (abs(R2(1,1))~=inf) R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); else R2(1,1) = 1; R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); end else if (R2(1,1)==0) R(1,m) = R1(1,m+1); if ((R1(1,1)*R2(1,2))>R1(1,2)) R(1,1) = -(1./0); P1 = P1+1; else R(1,1) = (1./0); end end end end if (R(1,1)==0)&&(R(1,m)==0)
  3. 3. H = R(1,1); for i = 1:L1+L2-n if (rem(i,2)~=0) G(1,i) = R2(1,(i+1)./2); else if (rem(i,2)==0) G(1,i) = 0; end end end r = roots(G); R3 = r'; for j = 1:length(R3) if (real(R3(1,j))<0.0001) P2 = P2+1; end end k = polyder(G); i = 2:4:(length(k)*2); k(:,(i+2)./2) = []; G1 = zeros(1,length(R2)-length(k)); R = horzcat(k,G1); end if (R(1,1)<0) P = P+1; end if (R2(1,1)*R(1,1)<0) P1 = P1+1; end disp(vpa(R)); R1 = R2; R2 = R; end if (P>0) disp(' '); disp('~:~:~:~:~:~:~The System is Unstable~:~:~:~:~:~:~'); else if (P==0) && (H==0) disp(' '); disp('~:~:~:~:~:~:~The System is Marginally Stable~:~:~:~:~:~:~'); else if (P==0) disp(' '); disp('~:~:~:~:~:~:~The System is Stable~:~:~:~:~:~:~') end
  4. 4. end end disp(' '); disp(['Roots to the right of imaginary axis in Z-plane:: ',num2str(P1)]); disp(['Roots to the left of imaginary axis in Z-plane:: ',num2str(L1+L2-P1-1-P2)]); disp(['Roots on the imaginary axis in Z-plane:: ',num2str(P2)]); else if (L1>L2) P = 0; P1 = 0; P2 = 0; Z = zeros(1,(L1-L2)); R = horzcat(b,Z); Z1 = horzcat(b,Z); R1 = a; disp(vpa(a)); disp(vpa(Z1)); H = 1; for n = 1:(L1+L2-2) R2 = R; for m = 1:(L1-1) if (R2(1,1)~=0) if (abs(R2(1,1))~=inf) R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); else R2(1,1) = 1; R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); end else if (R2(1,1)==0) R(1,m) = R1(1,m+1); if ((R1(1,1)*R2(1,2))>R1(1,2)) R(1,1) = -(1./0); P1 = P1+1; else R(1,1) = (1./0); end end end end if (R(1,1)==0)&&(R(1,m)==0) H = R(1,1); for i = 1:L1+L2-n if (rem(i,2)~=0) G(1,i) = R2(1,(i+1)./2);
  5. 5. else if (rem(i,2)==0) G(1,i) = 0; end end end r = roots(G); R3 = (r'); for j = 1:length(R3) if (real((R3(1,j)))<0.0001) P2 = P2+1; end end k = polyder(G); i = 2:4:(length(k)*2); k(:,(i+2)./2) = []; G1 = zeros(1,length(R2)-length(k)); R = horzcat(k,G1); end if (R(1,1)<0) P = P+1; end if (R2(1,1)*R(1,1)<0) P1 = P1+1; end disp(vpa(R)); R1 = R2; R2 = R; end if (P>0) disp(' '); disp('~:~:~:~:~:~:~The System is Unstable~:~:~:~:~:~:~'); else if (P==0) && (H==0) disp(' '); disp('~:~:~:~:~:~:~The System is Marginally Stable~:~:~:~:~:~:~'); disp(' '); disp(['The Roots Of The Auxiliary Eqn. are:: ',num2str(R3)]); else if (P==0) disp(' '); disp('~:~:~:~:~:~:~The System is Stable~:~:~:~:~:~:~') end end end
  6. 6. disp(' '); disp(['Roots to the right of imaginary axis in Z-plane:: ',num2str(P1)]); disp(['Roots to the left of imaginary axis in Z-plane:: ',num2str(L1+L2-1-P1-P2)]); disp(['Roots on the imaginary axis in Z-plane:: ',num2str(P2)]); end end if (L1 == L2) P = 0; P1 = 0; P2 = 0; H = 1; for h = 1:(L1-1) Q(1,h) = (((a(1,1).*b(1,h+1))-(b(1,1).*a(1,h+1)))./(a(1,1))); end L3 = length(Q); T = a; if (Q(1,1)==0)&&(Q(1,h)==0) for j = 1:(length(a)+length(b)-1) if (rem(j,2)~=0) Q(1,j) = T(1,(j+1)./2); else Q(1,j) = 0; end end r = roots(Q); R3 = r'; for j = 1:length(R3) if (real(R3(1,j))<0.0001) P2 = P2+1; end end K = polyder(Q); I = 2:4:(length(K)*2); K(:,(I+2)./2) = []; G2 = zeros(1,length(b)-length(K)); Q = horzcat(K,G2); end if (Q(1,1)<0) P = P+1; P1 = P1+1; end P3 = 0; Z = zeros(1,(L2-L3)); R = horzcat(Q,Z); Z1 = horzcat(Q,Z);
  7. 7. R1 = a; Z0 = zeros(1,(length(Z1)-L1)); D1 = horzcat(a,Z0); D2 = horzcat(b,Z0); disp(vpa(D2)); disp(vpa(D1)); disp(vpa(Z1)); for n = 1:(L1+L2-3) R2 = R; for m = 1:(L1-1) if (R2(1,1)~=0) if (abs(R2(1,1))~=inf) R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); else R2(1,1) = 1; R(1,m) = (((R2(1,1).*R1(1,m+1))-(R1(1,1).*R2(1,m+1)))./(R2(1,1))); end else if (R2(1,1)==0) R(1,m) = R1(1,m+1); if ((R1(1,1)*R2(1,2))>R1(1,2)) R(1,1) = -(1./0); P1 = P1+1; else R(1,1) = (1./0); end end end end if (R(1,1)==0)&&(R(1,m)==0) H = R(1,1); for i = 1:L1+L2-n if (rem(i,2)~=0) G(1,i) = R2(1,(i+1)./2); else if (rem(i,2)==0) G(1,i) = 0; end end end r = roots(G); R3 = r'; for j = 1:length(R3) if (real(R3(1,j))<0.0001) P2 = P2+1;
  8. 8. end end k = polyder(G); i = 2:4:(length(k)*2); k(:,(i+2)./2) = []; G1 = zeros(1,length(R2)-length(k)); R = horzcat(k,G1); end if (R(1,1)<0) P = P+1; end if (R2(1,1)*R(1,1)<0) P1 = P1+1; end disp(vpa(R)) R1 = R2; R2 = R; end if (P>0) disp(' '); disp('~:~:~:~:~:~:~The System is Unstable~:~:~:~:~:~:~'); else if (P==0) && (H==0) disp(' '); disp('~:~:~:~:~:~:~The System is Marginally Stable~:~:~:~:~:~:~'); disp(' '); disp(['The Roots Of The Auxiliary Equations Are:: ',num2str(R3)]) else if (P==0) disp(' '); disp('~:~:~:~:~:~:~The System is Stable~:~:~:~:~:~:~') end end end disp(' '); disp(['Effective no. of Roots to the right of imaginary axis in Z-plane:: ',num2str(P1)]); disp(['Effective no. of Roots to the left of imaginary axis in Z-plane:: ',num2str(L1+L2- P1-1-P2)]); disp(['Effective no. of Roots on the imaginary axis in Z-plane:: ',num2str(P2)]); end else ..... end disp(' '); y2 = input('Do you want to Rerun Program again?(y/n):: ','s');
  9. 9. if (y2~='y')&&(y2~='n') disp(' '); disp('Please Type "y" or "n"'); disp(' '); y2 = input('Do you want to Rerun Program again?(y/n):: ','s'); end if (y2=='y') y3 = input('Do you want to keep the previous analysis?(y/n):: ','s'); if (y3~='y')&&(y3~='n') disp(' '); disp('Please Type "y" or "n"'); disp(' '); y3 = input('Do you want to keep the previous analysis?(y/n):: ','s'); end end end if (y2=='n') disp(' '); disp('Program Terminated'); disp(' '); disp('*****You can "Press Any Key" to clear screen and "End Program"*****'); pause pause on; clc; end visit us at www.assignmentpedia.com or email us at info@assignmentpedia.com or call us at +1 520 8371215

×