pi is already defined; it is not a good idea to redefine it.
Remove your BG=5 line.
Immediately before you calculate Lvalues, add the line
BGs = [1 2 3 4 5 6 7 8 9 10];
L_pB = zeros(1,length(BGs));
for K = 1 : length(BGs)
BG = BGs(K);
Then, change your assignment that has L_pB on the left hand side, to instead of L_pB(:,K) on the left hand side. And then add the lines
right after that.
I have, though, not gone through the code to be sure that you only calculate a single L_pB value per BG value. If instead multiple values are calculated each time, change the 1 in the "zeros" line to be the number of items that are calculated each time (e.g., 7)
I did not join the points together in the plot because it is not clear to me that the points could be considered ordered or continuous.
Best Answer