early in your code, and then you iterate this loop:
precisely once as the result, so that:
magnetization_new(i) = magnetization * cosd(theta_new);
is calculated only once, and:
plots the one point you told it to plot.
I removed the subscript from ‘magnetization_new’ in the plot call because when you re-write your code and get vectors for ‘magnetization_new’ and ‘B’, that will throw an error because you will be plotting the vector of ‘B’ against only the last element of ‘magnetization_new’.
Beyond that, I don’t know what you’re doing so I can’t suggest a way to fix your code.