Loop correction of program. Zeeman Energy
5 views (last 30 days)
Show older comments
Attach please find the code for correction. All the details of errors are defined in the code for easy understanding. Graph result should be like black line in the attached jpg figure. Your help will be highly appreciated........
Regards
1 Comment
Walter Roberson
on 13 Sep 2015
Note for readers: the code attached does not produce any error messages, but does not produced the desired value.
Answers (1)
Walter Roberson
on 13 Sep 2015
Your initial_magnetization can be shown to be 2.2 * mu_b * nrowscols^2 . As mu_b starts as 9.2700e-24 and nrowscol is small (3), the initial magnetization is only 1.8355e-22. To calculate the new_energy, that value is multiplied by mag_field_reverse which is maximum 2, and by cosd() of something real-valued which is between -2.5 and +2.5 degrees. The cosd is therefore between 0.9990 and 1. And the negative is taken of all of this. Your new_energy is therefore between -3.6709e-22 and -3.6672e-22. The black line in your sample plot implies you expect values approaching 1.
But what is being plotted? It is Magnetization. Which is calculated as initial_magnetization * cosd() of the angle at which new_energy was minimum or which was accepted probabilistically. So each Magnetization is going to be initial_magnetization (1.8355e-22) times something that is between 0.9990 and 1.0 . You are not going to see much on a plot, even if you multiply by 1E22.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!