parfor makes wrong computations
이전 댓글 표시
hi
i've got some code that works correctly in normal mode, but outputs wrong results when run in parallel mode.
here is the simplest code i had to show you
parfor p4 = 1: 10
s2 = ['f1.txt'];
om2=pi*[linspace(0,0.6080,60),linspace(0.6082,1,40)];
D2=[zeros(1,60),exp(-1i*om2(1:40)*25)];
W2=[1000*ones(1,60),1*ones(1,1),1*ones(1,39)];
[b2,a2,e2]=mpiir_l2(25,23,om2,D2,W2,0.98);
Hhigh = dfilt.df1(b2,a2);
[h w] = freqz(Hhigh, 65536);
moy = 0;
p2 = round((0.6086+0.0114)*65536)
while p2<65536+1
mag = abs(h(p2));
if (mag > 1)
maxx = (mag - 1);
end;
if (mag < 1)
maxx = (1 - mag);
end;
moy = moy + maxx;
p2 = p2 +1;
end;
moy = moy / (65536-round((0.6086+0.0114)*65536));
f = fopen(s2, 'w');
fprintf(f, '%d\n', p4);
fprintf(f, 'moy(<0.007)=%f \n', moy);
fclose(f);
end;
thanks
Jeff
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!