Matlab:利用Matlab编程实现模拟分子布朗运动的动画展示
生活随笔
收集整理的這篇文章主要介紹了
Matlab:利用Matlab编程实现模拟分子布朗运动的动画展示
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Matlab:利用Matlab編程實現模擬分子布朗運動的動畫展示
?
?
目錄
輸出結果
實現代碼
?
?
?
輸出結果
?
實現代碼
%Brownian motion clf; n=20; s=0.02; x = rand(n,1)-0.5; y = rand(n,1)-0.5; h = plot(x,y,'.'); axis([-1 1 -1 1]) axis square grid off set(h,'EraseMode','xor','MarkerSize',18) grid on; title('Press Ctl-C to stop'); while 1 drawnow x = x + s*randn(n,1); y = y + s*randn(n,1); set(h,'XData',x,'YData',y) end clear;clc;%Initializetherandngenerator randn('state',1)%SettheparameterHandthesamplelength H=0.7;lg=10000; %Generateandplotwavelet-basedfBmforH=0.7 fBm=wfbm(H,lg);n=0:10; dt=2.^n; v=zeros(1,length(n)); fori=1:11d=fBm(1+dt(i):end)-fBm(1:end-dt(i));v(i)=sum(d.^2)./(length(d)-1);cleard; end p=polyfit(log(dt),log(v),1);loglog(dt,v,'ko'); holdon;sH=p(1)./2; ch=exp(p(2));plot(dt,ch.*dt.^(2.*sH),'b','LineWidth',1);%% clc; clearvars-exceptchsH; mch=ch; msH=sH; clearchsH;%Initializetherandngenerator randn('state',1)%SettheparameterHandthesamplelength H=0.7;lg=10000; fBm=fbm1d(H,lg);n=0:10; dt=2.^n; v=zeros(1,length(n)); fori=1:11d=fBm(1+dt(i):end)-fBm(1:end-dt(i));v(i)=sum(d.^2)./(length(d)-1);cleard; end p=polyfit(log(dt./lg),log(v),1);holdon; loglog(dt,v,'ks'); sH=p(1)./2; ch=exp(p(2));plot(dt,ch.*(dt./lg).^(2.*sH),'r','LineWidth',1);legend('matlab',strcat('Var=',num2str(mch),'*dt^{2.*',num2str(msH),'}'),'KB',strcat('Var=',num2str (ch),'*dt^{2.*',num2str(sH),'}'),'Location','SouthEast'); saveas(gcf,'test1.jpg');?
?
?
相關文章
Fractional Brownian motion generator
分數布朗運動及其模擬PDF參考文件
?
?
?
總結
以上是生活随笔為你收集整理的Matlab:利用Matlab编程实现模拟分子布朗运动的动画展示的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Py之wxPython:利用wxPyth
- 下一篇: ML之GB:GB算法相关论文、相关思路、