function [] = momentanpol()

a = 30;
b = 50;
l = 15;

n = 100;
T = 1;
t = 0:T/n:T;

C = zeros(n+1,2);
P = zeros(n+1,2);
M = zeros(n+1,2);

figure;

for i=1:n+1
    
    % FILLL
    % 
    % 
    % 
    % 
    % 
    % 
    % END FILL

    hold on;
    axis([-60 60 -60 60])
    plot(C(1:i,1), C(1:i,2), 'Color','black');
    plot(P(1:i,1), P(1:i,2), 'Color','red');
    plot(M(1:i,1), M(1:i,2), 'Color','green');
    hold off;
    pause(0.05);
end


end


function [C P VC VP] = coordinates(t,a,b,l)

Phi  = @(t) (2*pi*t);
dPhi = @(t) (2*pi);

C  = zeros(1,2);
P  = zeros(1,2);
VC = zeros(1,2);
VP = zeros(1,2);

C(1) = a * cos(Phi(t));
C(2) = b * sin(Phi(t));
term = (a/b)*(a/b)*C(2)*C(2) + (b/a)*(b/a)*C(1)*C(1);
P(1) = C(1) + l*(a/b)*C(2)/sqrt(term);
P(2) = C(2) - l*(b/a)*C(1)/sqrt(term);

VC(1) = - dPhi(t) * (a/b) * C(2);
VC(2) =   dPhi(t) * (b/a) * C(1);
VP(1) = VC(1) + l*dPhi(t)*C(1)/sqrt(term) ...
        - l*dPhi(t)*(a/b)*C(2)*(((a/b)-(b/a))*C(1)*C(2))/(term*sqrt(term));
VP(2) = VC(2) + l*dPhi(t)*C(2)/sqrt( term ) ...
        + l*dPhi(t)*(b/a)*C(1)*(((a/b)-(b/a))*C(1)*C(2))/(term*sqrt(term));
    
end