for x0=[-3 -1 1]

h=1;
while abs(h)>1e-4
    fx=(x0^3+3*x0^2-3)/(x0^2-x0-1);
    fpx=((3*x0^2+6*x0)*(x0^2-x0-1)-(x0^3+3*x0^2-3)*(2*x0-1))/((x0^2-x0-1)^2);
    h=-fx/fpx;
    x0=x0+h
end
plot(x0,0,'*')
hold on
end

x=-3:0.1:1;
y=(x.^3+3*x.^2-3)./(x.^2-x-1)
plot(x,y)