Problem with for loop in user defined function
I have written a code whose core is reported below. The problem is that when I run the last two indented for loop, in the resulting "summation" waves (running over the j index) I find only zero values (the syntax seems fine, I don't have a warning message when I run the function). I had already this problem when I was trying to have everything in the same "big" for loop (the first reported below). To try to fix the problem, I splitted up the code in two different for loop, as reported below, but still I have problems. I have no idea how to solve it, if somebody could help me it would be great....and really appreciated!
Many thanks in advance!
Duncan
(a desperate postdoc :-) )
for (j = 0; j
April 24, 2015 at 06:31 pm - Permalink
So, I would like to sum the all i-waves generated during the first loop, so to sum together the "N1s" waves with different i index but different j index. Doing this, after the second loop I would like to have a number of "summation" waves equal to "lambda_points", each one obtained by the summation of all the "N1s" waves bearing the same j index (but of course different i).
I hope in this way it will be more clear....many many thanks for the help,
Duncan
April 24, 2015 at 07:09 pm - Permalink
I found the bug: I was treating my "N1s" waves as a variable () and not as a wave. I have deleted the code line corresponding to the x3 specification and now it works!
Duncan
April 24, 2015 at 10:58 pm - Permalink