您好,欢迎访问三七文档
混沌映射(序列)matlabmatlabmatlabmatlab算法“小全”:LogisticLogisticLogisticLogistic、HenonHenonHenonHenon、帐篷、kentkentkentkent(含混沌二值图像生成函数)1.1.1.1.LogisticLogisticLogisticLogistic(罗切斯特)映射变换核:)1(1nnnxaxx−=+绘图程序:n=64;key=0.512;an=linspace(3.1,3.99,400);holdon;boxon;axis([min(an),max(an),-1,2]);N=n^2;xn=zeros(1,N);fora=an;x=key;fork=1:20;x=a*x*(1-x);%产生公式end;fork=1:N;x=a*x*(1-x);xn(k)=x;b(k,1)=x;%一维矩阵记录迭代结果end;plot(a*ones(1,N),xn,'k.','markersize',1);end;%figure;%imhist(b)实用混沌加密函数:functionichao_ans=ichaos_logistic(varargin)%logistic序列生成算法%函数名:%logistic混沌序列生成函数%参数:%(n,key),n为矩阵阶数,key为迭代初始值。%(n),n为矩阵阶数,key=0.600。%()或(n,key,...),n=64,key=0.600。switchnargin;case1;n=varargin{1};key=0.600;case2;n=varargin{1};key=varargin{2};otherwisekey=0.600;n=64;endN=n^2;xn=zeros(1,N);a=4;x=key;fork=1:20;x=a*x*(1-x);%产生公式end;fork=1:N;x=a*x*(1-x);xn(k)=x;%一维矩阵记录迭代结果end;c=reshape(xn,n,n);%一维矩阵转换二维矩阵d=zeros(n,n);%二维混沌矩阵调制fora1=1:n;fora2=1:n;ifc(a1,a2)=0.5;d(a1,a2)=1;elsed(a1,a2)=0;end;end;end;%figure;title('logistic映射');%imshow(d);ichao_ans=d;2.Henon2.Henon2.Henon2.Henon(埃农)映射变换核:21n11x{nnnnaxybxy−+==++绘图程序:b=0.3;N=400;an=ones(1,N);xn=zeros(1,N);holdon;boxon;x=0;y=0;fora=0:0.001:1.4fork=1:N;xm=x;ym=y;x=ym+1-a*xm.*xm;y=b*xm;endxn(1)=x;forn=2:N;xm=x;ym=y;x=ym+1-a*xm.*xm;y=b*xm;xn(n)=x;endplot(an*a,xn,'k.','markersize',1);endxlim([0,a]);实用混沌加密函数:functionichao_ans=ichaos_henon(varargin)%埃农(Henon)映射%0.2key0.314;理想范围(0.25—0.314)。重量较大。%参数:%(n,key),n为矩阵阶数,key为迭代初始值。%(n),n为矩阵阶数,key=0.314。%()或(n,key,...),n=64,key=0.314。switchnargin;case1;n=varargin{1};key=0.314;case2;n=varargin{1};key=varargin{2};otherwisekey=0.314;n=64;endn=64;N=n^2;an=ones(1,N);xn=zeros(1,N);x=0;y=0;a=1.4;forcir1=1:N;xm=x;ym=y;x=ym+1-a*xm.*xm;y=key*xm;endxn(1)=x;forcir2=2:N;xm=x;ym=y;x=ym+1-a*xm.*xm;y=key*xm;xn(cir2)=x;endc=reshape(xn,n,n);%一维矩阵转换二维矩阵d=zeros(n,n);%二维混沌矩阵调制fora1=1:n;fora2=1:n;ifc(a1,a2)=0;d(a1,a2)=1;elsed(a1,a2)=0;end;end;end;ichao_ans=d;314.02.0)4.1,0(a≤∈b3.3.3.3.帐篷映射变换核:||)1(1nnxaax+−=+绘图程序:%帐篷映射%0a1%a理想值0.99—1%0x1n=20;N=n^2;xp=zeros(1,N);Aa=ones(1,N);holdon;boxon;x=0.01;%初值fora=0:0.001:1;forn=1:N;x=a-(1+a)*abs(x);endfork=1:N;x=a-(1+a)*abs(x);xp(k)=x;endplot(Aa*a,xp,'k.','markersize',1);endxlim([0,a]);实用混沌加密函数:functionichao_ans=ichaos_tent(varargin)%帐篷映射%0a1%a理想值0.99—1%x初值作为密钥%0x1%参数:%(n,key),n为矩阵阶数,key为迭代初始值。%(n),n为矩阵阶数,key=0.99。%()或(n,key,...),n=64,key=0.99。switchnargin;case1;n=varargin{1};key=0.99;case2;n=varargin{1};key=varargin{2};otherwisekey=0.99;n=64;endN=n^2;xp=zeros(1,N);x=key;a=0.998;forcir1=1:N;x=a-(1+a)*abs(x);endforcir2=1:N;x=a-(1+a)*abs(x);xp(cir2)=x;endc=reshape(xp,n,n);%一维矩阵转换二维矩阵d=zeros(n,n);%二维混沌矩阵调制fora1=1:n;fora2=1:n;ifc(a1,a2)=0;d(a1,a2)=1;elsed(a1,a2)=0;end;end;end;%sum(sum(d))ichao_ans=d;%imshow(ichao_ans);)1,0(∈a4.kent4.kent4.kent4.kent(肯特)映射axaxxaaxnnnx≤≤−−=0,1,11{绘图程序:%肯特映射n=20;N=n^2;xp=zeros(1,N);Aa=ones(1,N);x=0.36;holdon;boxon;fora=0.01:0.001:0.5;forcir1=1:N;ifx=a;x=x/a;elsex=(1-x)/(1-a);endendforcir3=1:N;ifx=a;x=x/a;elsex=(1-x)/(1-a);endxp(cir3)=x;endplot(Aa*a,xp,'k.','markersize',1);endxlim([0,a]);实用混沌加密函数:functionichao_ans=ichaos_kent(varargin)%0.1x1,将初值作为密钥key%a0.5,当大于0.4时比较理想%参数:%(n,key),n为矩阵阶数,key为迭代初始值。%(n),n为矩阵阶数,key=0.8。%()或(n,key,...),n=64,key=0.8。switchnargin;case1;n=varargin{1};key=0.8;case2;n=varargin{1};key=varargin{2};otherwisekey=0.8;n=64;endN=n^2;xp=zeros(1,N);x=key;a=0.4;forcir1=1:N;ifx=a;x=x/a;elsex=(1-x)/(1-a);endendforcir3=1:N;ifx=a;x=x/a;elsex=(1-x)/(1-a);endxp(cir3)=x;endc=reshape(xp,n,n);%一维矩阵转换二维矩阵%figure;%imhist(c);d=zeros(n,n);%二维混沌矩阵调制fora1=1:n;fora2=1:n;ifc(a1,a2)=0.5;d(a1,a2)=1;elsed(a1,a2)=0;end;end;end;%sum(sum(d))ichao_ans=d;figure;imshow(ichao_ans);
本文标题:混沌映射(序列)matlab算法“小全”:Logistic、Henon、帐篷、kent(含混沌二值图
链接地址:https://www.777doc.com/doc-1806431 .html