function J = spring_function_2params(params,obs,t) C = params(1); K = params(2); factor = sqrt(K - C^2/4); denom = sqrt(4*K - C^2); f = 2*exp(-C*t/2).*cos(factor*t); J = (f-obs)*((f-obs)');