Fitting Large Data Sets
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!