Advertisement
siiikor

vis.m

Jan 11th, 2022
1,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.98 KB | None | 0 0
  1. global alfa;
  2. global beta;
  3. global gamma;
  4. global miu;
  5. global h;
  6. alfa = 3.3;
  7. beta = 1.5;
  8. gamma = 1.3;
  9. miu = 0.05;
  10. h = 4;
  11.  
  12. maxx = 5;
  13. maxy = 5;
  14.  
  15. [x,y] = meshgrid(linspace(0,maxx,20), linspace(0,maxy,20));
  16. dx = (alfa./(1+y**h))-(miu*x);
  17. dy = (beta*x)-(gamma*y);
  18.  
  19. opt = odeset('RelTol', 1e-9', 'AbsTol', 1e-9);
  20. maxT = 1000;
  21. v0 = 0.7;
  22. p0 = 0.1;
  23. sol1 = ode45(@bialko,[0,maxT],[v0;p0], opt);
  24. p1 = 0.15;
  25. sol2 = ode45(@bialko,[0,maxT],[v0;p1], opt);
  26. p2 = 0.2;
  27. sol3 = ode45(@bialko,[0,maxT],[v0;p2], opt);
  28.  
  29. figure(1);
  30. clf;
  31. quiver(x,y,dx,dy, 'AutoScale', 'on');
  32. hold on;
  33. plot(sol1.y(1,:), sol1.y(2,:),'r', sol2.y(1,:), sol2.y(2,:),'m', sol3.y(1,:), sol3.y(2,:),'k', 'LineWidth', 2);
  34. xlim([0,maxx]);
  35. ylim([0,maxy]);
  36. str_title = 'parametry: alfa: %d beta: %d gamma: %d miu: %d h: %d \nv0: %d p0: %d p1: %d p2: %d';
  37. str = sprintf(str_title, alfa, beta, gamma, miu, h, v0, p0, p1, p2);
  38. title(str);
  39. legend("pole wektorowe", "trzecia", "druga", "pierwsza")
  40. hold off
  41.  
  42. print figure3.pdf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement