日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab 两幅图不同,如何把两个不同M文件的图放在一起

發布時間:2025/3/21 循环神经网络 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab 两幅图不同,如何把两个不同M文件的图放在一起 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

好像還是行,按你說的方法,把兩個程序放在一起,但還只是顯示第二個程序的圖,第一個沒有顯示出來,這是程序原代碼,再幫我看看吧

%Generic Algorithm for function f(x1,x2) potimum

clear all;

close all;

%Parameters

Size=80;

G=100;

CodeL=10;

umax=2.048;

umin=-2.048;

E=round(rand(Size,2*CodeL));? ? %Initial Code

%Main Program

for k=1:1:Size

time(k)=k;

for s=1:1:Size

m=E(s,:);

y1=0;y2=0;

%Uncoding

m1=m(1:1:CodeL);

for i=1:1:CodeL

y1=y1+m1(i)*2^(i-1);

end

x1=(umax-umin)*y1/1023+umin;

m2=m(CodeL+1:1:2*CodeL);

for i=1:1:CodeL

y2=y2+m2(i)*2^(i-1);

end

x2=(umax-umin)*y2/1023+umin;

F(s)=100*(x1^2-x2)^2+(1-x1)^2;

end

Ji=1./F;

%*********Step 1:Evaluate BestJ***********

BestJ(k)=min(Ji);

fi=F;? ?? ?? ?? ? %Fitness Function

[Oderfi,Indexfi]=sort(fi);? ? %Arranging fi small to bigger

Bestfi=Oderfi(Size);? ?? ?? ? %Let Bestfi=max(fi)

BestS=E(Indexfi(Size),:);? ?? ? %m is the Indexfi belong to max(fi)

bfi(k)=Bestfi;

%****************Step 2:Select and Reproduct Operation**************

fi_sum=sum(fi);

fi_Size=(Oderfi/fi_sum)*Size;

fi_S=floor(fi_Size);? ?? ?? ?%Selecting Bigger fi value

kk=1;

for i=1:1:Size

for j=1:1:fi_S(i)? ?? ?? ?%Select and Reproduct

TempE(kk,:)=E(Indexfi(i),:);

kk=kk+1;? ?? ?? ?? ???%kk is used to reproduce

end

end

%***************Step 3:Crossover Operation***********************

pc=0.6;

n=ceil(20*rand);

for i=1:2:(Size-1)

temp=rand;

if pc>temp? ?? ?? ?? ?? ? %Crossover Condition

for j=n:1:20

TempE(i,j)=E(i+1,j);

TempE(i+1,j)=E(i,j);

end

end

end

TempE(Size,:)=BestS;

E=TempE;

%****************Step 4: Mutation Operation***********************

%pm=0.001;

%pm=0.001-[1:1:Size]*(0.001)/Size;? ? %Bigger fi,smaller Pm

%pm=0.0;? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?%No mutation

pm=0.1;? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? %Big mutation

for i=1:1:Size

for j=1:1:2*CodeL

temp=rand;

if pm>temp? ?? ?? ?? ?? ?? ?? ???%Mutation Condition

if TempE(i,j)==0

TempE(i,j)=1;

else

TempE(i,j)=0;

end

end

end

end

%Guarantee TempPop(30,:) is the code belong to the best individual(max(fi))

TempE(Size,:)=BestS;

E=TempE;

end

Max_value=Bestfi

BestS

x1

x2

fi_Size

fi_S

Oderfi

figure(1);

plot(time,BestJ,'r','linewidth',2);

xlabel('Times'); ylabel('BestJ');

hold on;

%Generic Algorithm for function f(x1,x2) potimum

clear all;

close all;

%Parameters

Size=500;

G=200;

CodeL=2;

MaxX(1)=2.048;

MinX(1)=-2.048;

MaxX(2)=2.048;

MinX(2)=-2.048;

E(:,1)=MinX(1)+(MaxX(1)-MinX(1))*rand(Size,1);? ? %Initial Code

E(:,2)=MinX(2)+(MaxX(2)-MinX(2))*rand(Size,1);

G=200;

BsJ=0;

%Main Program

for kg=1:1:G

time(kg)=kg;

%****************Step1:Evaluate BestJ******************

for i=1:1:Size

xi=E(i,:);

x1=xi(1);

x2=xi(2);

F(i)=100*(x1^2-x2)^2+(1-x1)^2;

Ji=1./F;

BsJi(i)=min(Ji);

end

%*********Step 1:Evaluate BestJ***********

[OderJi,IndexJi]=sort(BsJi);? ? %Arranging fi small to bigger

BestJ(kg)=OderJi(1);

BJ=BestJ(kg);

Ji=BsJi+1e-10;? ?? ?? ?? ?? ???%Avoiding deviding zero

fi=F;? ?? ?? ?? ? %Fitness Function

[Oderfi,Indexfi]=sort(fi);? ? %Arranging fi small to bigger

Bestfi=Oderfi(Size);? ?? ?? ? %Let Bestfi=max(fi)

BestS=E(Indexfi(Size),:);? ?? ? %m is the Indexfi belong to max(fi)

bfi(kg)=Bestfi;

%****************Step 2:Select and Reproduct Operation**************

fi_sum=sum(fi);

fi_Size=(Oderfi/fi_sum)*Size;

fi_S=floor(fi_Size);? ?? ?? ?? ? %Selecting Bigger fi value

r=Size-sum(fi_S);

Rest=fi_Size-fi_S;

[RestValue,Index]=sort(Rest);

for i=Size:-1:Size-r+1

fi_S(Index(i))=fi_S(Index(i))+1;? ?? ? %Adding rest to equal Size

end

k=1;

for i=Size:-1:1

for j=1:1:fi_S(i)

TempE(k,:)=E(Indexfi(i),:);

k=k+1;

end

end

%****************Step 3:Crossover Operation***********************************

Pc=0.9;

for i=1:2:(Size-1)

temp=rand;

if Pc>temp

alfa=rand;

TempE(i,:)=alfa*E(i+1,:)+(1-alfa)*E(i,:);

TempE(i+1,:)=alfa*E(i,:)+(1-alfa)*E(i+1,:);

end

end

TempE(Size,:)=BestS;

E=TempE;

%**************Step4: Mutation Operation**********************************

Pm=0.10-[1:1:Size]*(0.01)/Size? ?? ?%Bigger fi,smaller Pm

Pm_rand=rand(Size,CodeL);

Mean=(MaxX+MinX)/2;

Dif=(MaxX-MinX);

for i=1:1:Size

for j=1:1:CodeL

if Pm(i)>Pm_rand(i,j)

TempE(i,j)=Mean(j)+Dif(j)*(rand-0.5);

end

end

end

%Guarantee TempE(Size,:) belong to the best individual

TempE(Size,:)=BestS;

E=TempE;

end

Best_J=BestJ(G)

plot(time,BestJ,'-.','linewidth',2);

xlabel('Times');??ylabel('yd,y');

legend('Ideal position signal','Position signal tracking');

總結

以上是生活随笔為你收集整理的matlab 两幅图不同,如何把两个不同M文件的图放在一起的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。