function lab01roots = rootPlotLab01(Kp0,Kp1,Kd0,Kd1,Gamma)
% Plots biggest roots as Kp and Kd linearly vary from 0th->1th
% Defaults
dt = 1.0e-3;
m = 2;
points = 1000;
    function [natFreqs, outCoeffs, inCoeffs] = lab01rootsInt(Kp,Kd,G)
        % Gets the roots for the lab1 model.
        dt = 1e-3;
        m = 1;
        
        delC = G*Kd*dt/m;
        pC = G*Kp*dt*dt;
        outCoeffs = [1,-2,1+pC+delC,zeros(1,m-1),-delC];
        inCoeffs = [pC+delC,zeros(1,m-1),-delC];
        natFreqs = roots(outCoeffs);
        
    end
    lab01roots = @lab01rootsInt;


rTemplate = lab01roots(Kp0,Kd0,Gamma);
disp(rTemplate);
rootMat = zeros(size(rTemplate,1),points);
for i = 1:points
    Kd = Kd0 + (Kd1-Kd0)*i/points;
    Kp = Kp0 + (Kp1-Kp0)*i/points;
    rootMat(:,i) = lab01roots(Kp,Kd,Gamma);
end
figure(1);
plot(real(rootMat(abs(rootMat) > 0.9)),imag(rootMat(abs(rootMat) > 0.9)),'*');
figure(2);
plot(abs(rootMat(abs(rootMat) > 0.9)),'*');
figure(3);
plot(abs(rootMat(abs(rootMat) > 0.9).^1000),'*');
end
