Fitting Large Data Sets

조회 수: 2 (최근 30일)
Nicholas Williams
Nicholas Williams 2015년 8월 28일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by