Does anyone know if there is a function to fit a line with a specified slope to some data. I have a load of data 'x' and polyfit(1:length(x),x,1) gives me the best-fit line, with arbitrary slope.
What I want however is the best fit line with a particular slope. This is essentially just a minimization problem and I know I could code something up myself, but x has 100's of millions of elements I'm guessing my coding efforts will take forever to run, so does such a nice function already exist? It is essentially polyfit with an added constraint that the slope is fixed.