function J = nonmal_lst(p0,tdata,pdata)
% Least Squares fit to Nonautonomous Malthusian Growth
N = length(tdata);
p = p0(1);
pop = [p];
err = [pdata(1) - p];
for i = 2:N  % Nonautonomous iteration
    p = p*(1 + p0(2) + p0(3)*(i-1));
    pop = [pop,p];
    err = [err, pdata(i) - p];
end
J = err*err'; % Sum of square errors
end

