function [] = plotroots(z, n)
    r = abs(z);
    a = angle(z);

    clf;

    % First plot z in red
    x = real(z);
    y = imag(z);
    hold on
    plot([0 x],[0 y], 'r', 'linewidth', 1);
    plot(x, y, 'r.', 'MarkerSize', 8);
    text(x, y, 'z', 'HorizontalAlignment','left');
    axis equal;
    hold off

    % Then plot roots in blue
    rr = r ^ (1/n);
    aa = a / n;
    for k = 0:n-1;
        w = rr * exp((0+1i)*(a+2*pi*k)/n);
        x = real(w);
        y = imag(w);
        hold on
        plot([0 x],[0 y], 'b', 'linewidth', 1);
        plot(x, y, 'b.', 'MarkerSize', 8);
        axis equal;
        hold off
    end
end
