Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2. function m = main()
  3. for t=[0:500]
  4. phi=t/500*2*pi;
  5. k=1*pi/(2*pi-phi);
  6. [x,y] = meshgrid(-10:0.5:10);
  7. [u,v] = fun(x,y,k,phi);
  8. quiver(x,y,u,v);
  9. hold on;
  10. plot(0:10, zeros(1,11) );
  11. [o,p]=pol2cart((2*pi-phi) * ones(1,11),0:10);
  12. plot(o,p);
  13. hold off;
  14. filename=sprintf('output/%05d.jpg',t);
  15. print(filename);
  16. end
  17. end
  18.  
  19. function [u,v] = fun(x, y, k, phi)
  20. [l,s] = cart2pol(x,y);
  21. l=l+2*pi*(l<0);
  22. u= k .* s.^(k-1) .* (sin(k.*l) .* cos(l) - cos(k.*l).*sin(l)).*(l<=2*pi-phi);
  23. v= k .* s.^(k-1) .* (sin(k.*l) .* sin(l) + cos(k.*l).*cos(l)).*(l<=2*pi-phi);
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement