SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function phaseport
  2.  
  3. tmax=50;
  4. %tip sedlo
  5. %A=[1,2;4,3]; b=[1;-1]
  6. %vuzel, ustoichiv zashtoto v D ima edna + sobstvena stoinost; inache
  7. %razbirame tova ot dopiratelnite vektori
  8. %A=[-1,0;0,-2]; b=[-1;-6]
  9. %neustoichiv vuzel
  10. %A=[3,1;4,3]; b=[-3;-4]
  11. %fokus - ustoichiv
  12. %A=[-5,1;-18,1]; b=[0;0]
  13. %centur-neustoichiv
  14. %A=[-2,-4;2,2]; b=[0;-2]
  15. %dikritichen vuzel - neustoichiv - 2 polojiteni sobstveni stoinosti
  16. A=[2,0;0,2]; b=[0;-2]
  17.  
  18. s=A\(-b);
  19. plot(s(1),s(2),'*')
  20. axis([s(1)-5,s(1)+5,s(2)-5,s(2)+5])
  21. hold on
  22. grid on
  23.  
  24. [T,D]=eig(A)
  25.  
  26. % chertaem 2 pravi:
  27. if imag(D(1,1)==0)
  28.     xx=-10:1:10
  29.     for j=1:2
  30.         if T(1,1)~=0
  31.             plot(xx+s(1),T(2,j)/T(1,j)*xx+s(2),'k')
  32.         else
  33.             plot(0*xx+s(1),xx,'k')
  34.         end
  35.     end
  36. end
  37.  
  38. x=s(1)-4:2:s(1)+4;
  39. y=s(1)-4:2:s(1)+4;
  40.  
  41. %mrezha:
  42. [X,Y]=meshgrid(x,y)
  43. %zadacha na koshi
  44. for i=1:length(x)
  45.     for j=1:length(y)
  46.         [T,Z]=ode45(@f,[0,tmax],[X(i,j),Y(i,j)]);
  47.         [T1,Z1]=ode45(@f,[0,-tmax],[X(i,j),Y(i,j)]);
  48.         plot(Z(:,1),Z(:,2),Z1(:,1),Z1(:,2),'b')
  49.     end
  50. end
  51.  
  52. %dyasnata strana
  53. function z=f(t,y)
  54. z=A*y+b;
  55. end
  56.  
  57.  
  58. DX=A(1,1)*X+A(1,2)*Y+b(1);
  59. DY=A(2,1)*X+A(2,2)*Y+b(2);
  60.  
  61. %normirame vektora (DX;DY) - kato go delim na duljinata mu
  62. d=sqrt(DX.^2+DY.^2)
  63. quiver(X,Y,DX,DY,'r')
  64.  
  65.  
  66. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top