⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tt.m

📁 这个是我的毕业设计做的我觉得对大家还是有写用的
💻 M
字号:
function varargout = tt(varargin)
% TT M-file for tt.fig
%      TT, by itself, creates a new TT or raises the existing
%      singleton*.
%
%      H = TT returns the handle to a new TT or the handle to
%      the existing singleton*.
%
%      TT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in TT.M with the given input arguments.
%
%      TT('Property','Value',...) creates a new TT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before tt_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to tt_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help tt

% Last Modified by GUIDE v2.5 25-May-2006 10:30:52
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @tt_OpeningFcn, ...
                   'gui_OutputFcn',  @tt_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before tt is made visible.
function tt_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to tt (see VARARGIN)

% Choose default command line output for tt
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes tt wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = tt_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
Size=80;   
G=1000;     
CodeL=21;
umax=10.;
umin=-10;
E=round(rand(Size,CodeL));    
for k=1:1:G
time(k)=k;
for s=1:1:Size
m=E(s,:);
y=0;
m1=m(1:1:CodeL);
for j=1:1:CodeL
   y=y+m1(j)*2^(j-1);
end
x=(umax-umin)*y/2097151+umin;
F(s)=x^6-15*x^4+27*x^2+250;
end
fi=F;                          
[Oderfi,Indexfi]=sort(fi);     
Minfi=Oderfi(1);           
MinS=E(Indexfi(1),:);     
bfi(k)=Minfi;
   fi_sum=sum(fi);
   fi_Size=(Oderfi/fi_sum)*Size;
   fi_S=floor(fi_Size);       
   kk=1;
   for i=1:1:Size
      for j=1:1:fi_S(i)        
       TempE(kk,:)=E(Indexfi(i),:);  
         kk=kk+1;              
      end
   end
pc=0.60;
n=ceil(20*rand);
for i=1:2:(Size-1)
    temp=rand;
    if pc>temp                  
    for j=n:1:20
        TempE(i,j)=E(i+1,j);
        TempE(i+1,j)=E(i,j);
    end
    end
end
TempE(Size,:)=MinS;
E=TempE;
pm=0.1;   
 for i=1:1:Size
      for j=1:1:CodeL
         temp=rand;
         if pm>temp               
            if TempE(i,j)==0
               TempE(i,j)=1;
            else
               TempE(i,j)=0;
            end
        end
      end
   end
TempE(Size,:)=MinS;
E=TempE;
end

x

Min_Value=Minfi% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)clc% --- Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
Size=80;   
G=10000;     
CodeL=21;
umax=10.;
umin=-10;
E=round(rand(Size,CodeL));    
for k=1:1:G
time(k)=k;
for s=1:1:Size
m=E(s,:);
y=0;
m1=m(1:1:CodeL);
for j=1:1:CodeL
   y=y+m1(j)*2^(j-1);
end
x=(umax-umin)*y/2097151+umin;
F(s)=x^6-15*x^4+27*x^2+250;
end
fi=F;                          
[Oderfi,Indexfi]=sort(fi);     
Minfi=Oderfi(1);           
MinS=E(Indexfi(1),:);     
bfi(k)=Minfi;
   fi_sum=sum(fi);
   fi_Size=(Oderfi/fi_sum)*Size;
   fi_S=floor(fi_Size);       
   kk=1;
   for i=1:1:Size
      for j=1:1:fi_S(i)        
       TempE(kk,:)=E(Indexfi(i),:);  
         kk=kk+1;              
      end
   end
pc=0.60;
n=ceil(20*rand);
for i=1:2:(Size-1)
    temp=rand;
    if pc>temp                  
    for j=n:1:20
        TempE(i,j)=E(i+1,j);
        TempE(i+1,j)=E(i,j);
    end
    end
end
TempE(Size,:)=MinS;
E=TempE;
pm=0.1;   
 for i=1:1:Size
      for j=1:1:CodeL
         temp=rand;
         if pm>temp               
            if TempE(i,j)==0
               TempE(i,j)=1;
            else
               TempE(i,j)=0;
            end
        end
      end
   end
TempE(Size,:)=MinS;
E=TempE;
end

x

Min_Value=Minfi% --- Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)close(tt)
close(qq)% --- If Enable == 'on', executes on mouse press in 5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton3.function pushbutton3_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to pushbutton3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes during object creation, after setting all properties.function pushbutton3_CreateFcn(hObject, eventdata, handles)% hObject    handle to pushbutton3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% --- Executes during object deletion, before destroying properties.function pushbutton3_DeleteFcn(hObject, eventdata, handles)% hObject    handle to pushbutton3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- If Enable == 'on', executes on mouse press in 5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton4.function pushbutton4_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to pushbutton4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes during object creation, after setting all properties.function pushbutton4_CreateFcn(hObject, eventdata, handles)% hObject    handle to pushbutton4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% --- Executes during object deletion, before destroying properties.function pushbutton4_DeleteFcn(hObject, eventdata, handles)% hObject    handle to pushbutton4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- If Enable == 'on', executes on mouse press in 5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton5.function pushbutton5_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to pushbutton5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes during object creation, after setting all properties.function pushbutton5_CreateFcn(hObject, eventdata, handles)% hObject    handle to pushbutton5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% --- Executes during object deletion, before destroying properties.function pushbutton5_DeleteFcn(hObject, eventdata, handles)% hObject    handle to pushbutton5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- If Enable == 'on', executes on mouse press in 5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton6.function pushbutton6_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to pushbutton6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes during object creation, after setting all properties.function pushbutton6_CreateFcn(hObject, eventdata, handles)% hObject    handle to pushbutton6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% --- Executes during object deletion, before destroying properties.function pushbutton6_DeleteFcn(hObject, eventdata, handles)% hObject    handle to pushbutton6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)

⌨️ 快捷键说明

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