Alx09

TS2

Apr 13th, 2021 (edited)
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear
  2. clc
  3. syms s z
  4. u=(s+1)*(s+10)*(s+15);
  5. %u=4*z^4-3*z^3+2*z^2+5;
  6. rad_s=0;
  7. rad_z=0;
  8. rad_s=double(solve(u,s));
  9. %rad_z=double(solve(u,z));
  10. k=0;
  11. if(rad_s~=0)
  12. for i=1:length(rad_s)
  13.     if(rad_s(i)<0)
  14. disp(['s',num2str(i),'=',num2str(rad_s(i)),' < 0'])
  15.     elseif(rad_s(i)==0)
  16. disp(['s',num2str(i),'=',num2str(rad_s(i)),' = 0 => marginal stabil'])
  17.     elseif(rad_s(i)>0)
  18. disp(['s',num2str(i),'=',num2str(rad_s(i)),' > 0 => instabil'])
  19.     end
  20. end
  21. for i=1:length(rad_s)
  22. if(rad_s(i)==0)
  23.     k=-1;
  24. elseif(rad_s(i)>0)
  25.     k=-2;
  26.     break
  27. end
  28. end
  29. switch k
  30.     case 0
  31.         disp('s - asimptotic stabil')
  32.     case -1
  33.         disp('s - marginal stabil')
  34.     case -2
  35.         disp('s - instabil')
  36. end
  37. end
  38. k=0;
  39. if(rad_z~=0)
  40. for i=1:length(rad_z)
  41. disp(['|z',num2str(i),'|=',num2str(abs(rad_z(i)))])
  42. end
  43. for i=1:length(rad_z)
  44. if(abs(rad_z(i))==1)
  45.     k=-1;
  46. elseif(abs(rad_z(i))>1)
  47.     k=-2;
  48.     break
  49. end
  50. end
  51. switch k
  52.     case 0
  53.         disp('z - asimptotic stabil')
  54.     case -1
  55.         disp('z - marginal stabil')
  56.     case -2
  57.         disp('z - instabil')
  58. end
  59. end
RAW Paste Data