I'm currently working with sequences of images and I'm interested in the temporal dynamics of individual pixels. Typically I have a series of approx. 50 images with 250 000 pixels of interest and I want to fit them to 5-10 time-activity curves of reference. I need to do a non-negative fitting because negative coefficients are physically nonsensical in my problem.
At the moment, I'm basically doing this
nPixels = 250 000;
nRefTACs = 5;
nImages = 50;
nnCoeff = zeros(nRefTACs, nPixels);
for k = 1:nPixels
nnCoeff(:,k) = lsqnonneg(refTACs, imTS(:,k));
I'm wondering if there would be a way to speed this up by vectorization or by using another optimization function. I've been browsing the optimization toolbox documentation for some time, but I'm not very familiar with optimization in general.
Any help would be appreciated.