reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

dynarrow.m (557B)


      1 function []=dynarrow(a,b,num);
      2 
      3 
      4 % dynarrow.m   function []=dynarrow(a,b);
      5 %
      6 %  Draws "dynamic arrows" (like Solow diagram) from point a to point b.
      7 %  a=(x0 y0),  b=(x1 y1);
      8 %  num = number of arrows to draw
      9 
     10 hold on;
     11 
     12 sl=(b(2)-a(2))/(b(1)-a(1));  % slope = rise/run
     13 %dist=sqrt( (b(1)-a(1))^2 + (b(2)-a(2))^2);  % total distance
     14 %step=dist/(num+1);
     15 xstep=(b(1)-a(1))/(num+1);
     16 ystep=(b(2)-a(2))/(num+1);
     17 start=[a(1)+.5*xstep a(2)+.5*ystep];
     18 
     19 angle=25;
     20 
     21 for i=1:num;
     22   next=[start(1)+xstep start(2)+ystep];
     23   chadarrow(start,next,angle);
     24   start=next;
     25 end;
     26