dim_fract.m

来自「calculates the fractal dimension of a se」· M 代码 · 共 43 行

M
43
字号
function  Dim_Fract(a,b)%   initialisation des variablesT_x=a;T_y=b;x=a;y=b;Kmax=100;Lm_T=0;%****************************************************N=length(y);for k=1:Kmax    L(k)=(N-1)/k*sum(sqrt((y(1:end-k)-y(1+k:end)).^2+(x(1:end-k)-x(1+k:end)).^2));end%****************************************************for i=1:Kmax   if(L(:,i)~=0 )    x2(:,i)=log(i);    y2(:,i)=log(L(:,i));   end end   l=length(x2)p2=polyfit(x2(1:30),y2(1:30),1);BestFit2=polyval(p2,x2);D_T=1-p2(:,1);for i=1:lLm_T=Lm_T+L(:,i);endLm_T=Lm_T/l;save Lm_T Lm_T;save DF_T D_T;plot(x2,y2,'b.','LineWidth',1)hold onplot(x2(1:l), BestFit2(1:l),'r-','Linewidth',2)xlabel('Jauge, log N', 'FontSize',10)ylabel('Longueur mesur閑, log N(s)' , 'FontSize',10)title(['Longueur Moyenne= ',num2str(Lm_T,'%10.4f'),' Dimension fractale= ',num2str(D_T,'%10.4f')]);h = legend('sujet normal',-1);set(h,'Interpreter','none');hold offsaveas(gcf,'Courbe_T.fig');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?