Hi,
if you call your function with the initial values
F(vr0)
you get:
>> F(vr0)
ans =
1.0e+04 *
Columns 1 through 3
NaN + NaNi NaN + NaNi NaN + NaNi
Columns 4 through 6
NaN + NaNi 0.0001 + 0.0000i 0.0001 + 0.0000i
Columns 7 through 9
0.0000 + 0.0000i -0.0001 + 0.0000i -0.0003 + 0.0000i
Columns 10 through 12
The columns 1...4 return NaN, which is the problem. If you instead use
vr0=ones(1,100);
then you get infinite imaginary parts for the first 4 values:
>> F(vr0)
ans =
1.0e+04 *
Columns 1 through 3
0.0000 - Infi 0.0000 - Infi 0.0001 - Infi
Columns 4 through 6
0.0001 - Infi 0.0001 - 0.0765i 0.0001 - 0.0632i
Columns 7 through 9
-0.0000 - 0.0537i -0.0002 - 0.0465i -0.0004 - 0.0410i
Columns 10 through 12
Either you correct an issue in your function, that leads to this problem or you find a valid initial array to fix this issue.
A possible workaround is:
...
drdr=[5*drdr:drdr:1];
...
vr0=zeros(1,numel(drdr));
...
which leaves the critical values out. You have to decide if this is an acceptable way.
Best regards
Stephan