function m = SN_movie(num_motes)
%
% m = SN_movie(10);
% movie2avi(m,'grads');

R = 10;
t = 0:(2*pi/360):2*pi;
x = R*cos(t);
y = R*sin(t);
motes = 6*rand(num_motes,2);
motes = [motes(:,1)-mean(motes(:,1)), motes(:,2)-mean(motes(:,2))];

for index = 1:360
    grads = -[motes(:,1)-x(index), motes(:,2)-y(index)];
    clf;
    plot(-(R+1),-(R+1),'b.',R+1,R+1,'b.');
    hold on
    plot(motes(:,1),motes(:,2),'og');
    plot(x(index),y(index),'*r');
    for m_index = 1:num_motes
        m_norm = grads(m_index,:)./norm(grads(m_index,:));
        plot([motes(m_index,1),motes(m_index,1)+m_norm(1)],...
            [motes(m_index,2),motes(m_index,2)+m_norm(2)]);
    end
    m(index) = getframe;
end
