【发布时间】:2015-11-11 02:16:04
【问题描述】:
有没有人能帮我提高下面代码的速度,太长了。问候。
limits(1) = 3.2;
limits(3) = 3.6;
x = ones(426,1);
y = ones(426,1);
BandWidth = 20;
height = 586;
width = 896;
dmap = zeros(height, width);
parfor jj = 0 : width - 1
myTemp = zeros(1, height);
xi = limits(1) + jj;
for ii = 0: height - 1
yi = limits(3) + ii;
myTemp(ii+1) = sum( exp(-((x - xi).^2 + (y - yi).^2)/(2*BandWidth^2)) );
end
dmap(:,jj+1) = myTemp';
end
dmap = (1/(sqrt(2*pi)*BandWidth))*dmap;
期待听到一些提示。
【问题讨论】:
-
仅供参考,这可能更适合codereview.stackexchange.com
标签: performance matlab for-loop parfor