Fitting Large Data Sets

I normally deal with rather large data sets (i.e. 700x1600x500 complex valued cubes). Often, I want to fit one of the dimensions at each point (cube(x,y,:) -> lsqcurvefit(@fun, z0, zAxis, zData)). Is there a good way to consolidate and vectorize this process through MeshGrids or something similar? Right now I just use a nested for loop over x and y /*cringing*/. Was wondering if anyone has a clever trick for dealing with this.
for x = 1:size(data, 1)
for y = 1:size(data, 2)
zData = squeeze(abs(data(x,y,:)));
fun = @(p, zAxis) p(1)*exp(-zAxis/p(2)); %or your favorite function
z0 = [1 1];
fitResult = lsqcurvefit(fun, z0, zAxis, zData);
%disp(fitResult)
end
end
It's just screaming at me that matlab has to have some more efficient way of doing this.
Thanks

Respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Ag. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by