伊辛模型MATLAB源代碼_第1頁
伊辛模型MATLAB源代碼_第2頁
伊辛模型MATLAB源代碼_第3頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、伊辛(Ising)模型MATLAB源程序代碼clear all;close all;clcN=16;Te=0:0.2:5;imax=;MT=zeros(1,length(Te);Cv=zeros(1,length(Te);xx=zeros(1,length(Te);L=1;k=1;for T=TeMt=zeros(1,imax);step=;spin=round(rand(N).*2-1;subplot(3,2,1)gspin=pcolor(spin);colormap(gray(2);title(自旋分布情況);Mt=zeros(1,imax);subplot(3,2,2)gMt=plot(

2、1:imax,Mt);axis(0 imax -1.1 1.1);title(固定溫度下的磁矩);%xlabel(時間);%ylabel(Mt);%initial energy idx=repmat(:,ndims(spin),1); idx1=N 1:N-1; Etotal=spin(idx:); idx=repmat(:,ndims(spin),1); idx2=N 1:N-1; Etotal=Etotal+spin(idx:); idx=repmat(:,ndims(spin),1); idx1=2:N 1; Etotal=Etotal+spin(idx:); idx=repmat(:,

3、ndims(spin),1); idx2=2:N 1; Etotal=Etotal+spin(idx:); Etotal=spin.*Etotal; Et0=zeros(1,imax); Et0(1)=-sum(sum(Etotal)/2; subplot(3,2,3);gEt=plot(1:imax,Et0);Ett=Et0(1); title(固定溫度下的能量); %xlabel(時間); %ylabel(Et);%energy end subplot(3,2,4); gMT=plot(Te,MT,o-); axis(0 max(Te) 0 1.1); title(磁矩隨溫度T的變化);

4、%xlabel(T); %ylabel(MT); subplot(3,2,5) gCv=plot(Te,Cv,o-); %axis(0 max(Te) 0 700); title(熱容隨溫度T的變化); %xlabel(T); %ylabel(Cv); subplot(3,2,6) gxx=plot(Te,xx,o-); %axis(0 max(Te) 0 0.1); title(磁導率隨溫度T的變化); %xlabel=(T); %ylabel=(X);for i=2:imax a=ceil(rand(1,2).*N); if a(1)=1 xl=N; else xl=a(1)-1; end

5、 if a(1)=N xr=1; else xr=a(1)+1; end if a(2)=1 yd=N; else yd=a(2)-1; end if a(2)=N yu=1; else yu=a(2)+1; end ds=spin(a(1),yu)+spin(a(1),yd)+spin(xl,a(2)+spin(xr,a(2);de=2.*spin(a(1),a(2).*ds; if randexp(-de/T) spin(a(1),a(2)=-spin(a(1),a(2); Ett=Ett+de; end Mt(i)=sum(sum(spin)/(N2); Et0(i)=Ett; if mod(i,step)=0 set(gspin,Cdata,double(spin); set(gMt,Ydata,Mt); set(gEt,Ydata,Et0); drawnow end end Cv(L)=1/(T2).*(mean(Et0.2)-mean(Et0)2); xx(L)=1/T.*(mean(Mt.2)-mean(Mt)2); MT(L)=mean(abs(Mt(0.9*imax:imax); set(gMT,Ydata,

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論