parallel computing problem in subfuction

1 Ansicht (letzte 30 Tage)
lv
lv am 17 Nov. 2014
Bearbeitet: lv am 17 Nov. 2014
I have this simple parfor code
Ne = round((E0max - E0min)/dE0);
parfor count =1:Ne
[etap, etaNzrp(count)] = shooting(E0min+(count-1)*dE0);
end
when I run in for loop, it looks just fine. But this parfor loop report an error in subfunc shooting.
function [eta, etaNz] = shooting(E)
% Shooting method
global m Eref Unef Egw bwbwbwb Egb dz Angstrom Nz hbar U e
% Conduction band nonparabolicity
mn = m .* ((1 + (E - Eref - Unef) / Egw) .* (bwbwbwb == 0) + (1 + (E - Eref - Unef) / Egb) .* (bwbwbwb == 1));
if (min(mn) <= 0)
disp('Error! Mass is negative!')
return
end
eta = zeros(1, Nz);
eta(2) = eps * dz * Angstrom;
...
...
the error appear in 'eta(2) = eps * dz * Angstrom;'
In an assignment A(I) = B, the number of elements in B and I must be the same.
How to fix it?

Antworten (0)

Kategorien

Mehr zu Parallel Computing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by