📄 bp_axles.asv
字号:
function varargout = BP_Axles(varargin)
% BP_AXLES M-file for BP_Axles.fig
% BP_AXLES, by itself, creates a new BP_AXLES or raises the existing
% singleton*.
%
% H = BP_AXLES returns the handle to a new BP_AXLES or the handle to
% the existing singleton*.
%
% BP_AXLES('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in BP_AXLES.M with the given input arguments.
%
% BP_AXLES('Property','Value',...) creates a new BP_AXLES or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before BP_Axles_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to BP_Axles_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help BP_Axles
% Last Modified by GUIDE v2.5 09-May-2006 13:35:38
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @BP_Axles_OpeningFcn, ...
'gui_OutputFcn', @BP_Axles_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(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 BP_Axles is made visible.
function BP_Axles_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 BP_Axles (see VARARGIN)
% Choose default command line output for BP_Axles
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes BP_Axles wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = BP_Axles_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;
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit_DataTest_Show_Callback(hObject, eventdata, handles)
% hObject handle to edit_DataTest_Show (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit_DataTest_Show as text
% str2double(get(hObject,'String')) returns contents of edit_DataTest_Show as a double
% --- Executes during object creation, after setting all properties.
function edit_DataTest_Show_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_DataTest_Show (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in pb_DataTrain_In.
function pb_DataTrain_In_Callback(hObject, eventdata, handles)
% hObject handle to pb_DataTrain_In (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
user_data=get(gcf,'userdata');
[name,path]=uigetfile('*.mat','Load data set');
pathname=strcat(path,name);
file.name=name; file.path=path; file.pathname=pathname;
LoadData=load('-mat',file.pathname);
T_Data=LoadData.BPchilunInput;
T_Data=T_Data';
set(findobj('Tag','edit_DataIn_Show'),'String',num2str(T_Data));
user_data.I_Data=T_Data;
%subplot('position',[606 22.692 50.2 19.308]);
plot(findobj('Tag','axes_DataIn'),T_Data(1,:),(T_Data(2,:)+T_Data(3,:))/2,'r+');
set(gcf,'userdata',user_data);
% --- Executes on button press in pb_DataTar_In.
function pb_DataTar_In_Callback(hObject, eventdata, handles)
% hObject handle to pb_DataTar_In (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
user_data=get(gcf,'userdata');
[name,path]=uigetfile('*.mat','Load data set');
pathname=strcat(path,name);
file.name=name; file.path=path; file.pathname=pathname;
LoadData=load('-mat',file.pathname);
T_Data=LoadData.BPchilunTarget;
T_Data=T_Data';
user_data.T_Data=T_Data;
%subplot('position',[0.041 0.338 0.443 0.624]);
plot(findobj('Tag','axes_DataTar'),T_Data(1,:),(T_Data(2,:)+T_Data(3,:))/2,'r+');
set(findobj('Tag','edit_DataTar_Show'),'String',num2str(user_data.T_Data));
set(gcf,'userdata',user_data);
% --- Executes on button press in pb_DataTest_In.
function pb_DataTest_In_Callback(hObject, eventdata, handles)
% hObject handle to pb_DataTest_In (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
user_data=get(gcf,'userdata');
[name,path]=uigetfile('*.mat','Load data set');
pathname=strcat(path,name);
file.name=name; file.path=path; file.pathname=pathname;
LoadData=load('-mat',file.pathname);
name=strtok(name,'.');
name=strcat('LoadData.',name);
str=strcat('T_Data=',name);
eval(str);
T_Data=T_Data';
user_data.Tt_Data=T_Data;
%subplot('position',[0.041 0.338 0.443 0.624]);
plot(findobj('Tag','axes_DataTest'),T_Data(1,:),(T_Data(2,:)+T_Data(3,:))/2,'r+');
set(findobj('Tag','edit_DataTest_Show'),'String',num2str(user_data.Tt_Data));
set(gcf,'userdata',user_data);
% --- Executes on button press in pb_SAT.
function pb_SAT_Callback(hObject, eventdata, handles)
% hObject handle to pb_SAT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
user_data=get(gcf,'UserData');
threshold=[0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1];
net=newff(threshold,[31 5],{''tansig'',''logsig''},''trainlm'');
net.trainParam.epochs=e;
net.trainParam.goal=learngoal;
LP.lr=learnrate;
net=train(net,P,T);
Y=sim(net,V);
BPresult(Y)
function edit_trainepochs_Callback(hObject, eventdata, handles)
% hObject handle to edit_trainepochs (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit_trainepochs as text
% str2double(get(hObject,'String')) returns contents of edit_trainepochs as a double
user_data=get(gcf,'userdata');
epochs=str2double(get(hObject,'String'));
if(isnan(epochs))
errordlg('请输入训练次数');
end
user_data.epochs=epochs;
set(gcf,'userdata',user_data);
% --- Executes during object creation, after setting all properties.
function edit_trainepochs_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_trainepochs (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
user_data=get(gcf,'userdata');
epochs=str2double(get(hObject,'String'));
user_data.epochs=epochs;
set(gcf,'userdata',user_data);
function edit_traingoal_Callback(hObject, eventdata, handles)
% hObject handle to edit_traingoal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit_traingoal as text
% str2double(get(hObject,'String')) returns contents of edit_traingoal as a double
user_data=get(gcf,'userdata');
goal=str2double(get(hObject,'String'));
if(isnan(goal))
errordlg('请输入训练目标');
end
user_data.goal=goal;
set(gcf,'userdata',user_data);
% --- Executes during object creation, after setting all properties.
function edit_traingoal_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_traingoal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
user_data=get(gcf,'userdata');
goal=str2double(get(hObject,'String'));
user_data.goal=goal;
set(gcf,'userdata',user_data);
function edit_learnrate_Callback(hObject, eventdata, handles)
% hObject handle to edit_learnrate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit_learnrate as text
% str2double(get(hObject,'String')) returns contents of edit_learnrate as a double
user_data=get(gcf,'userdata');
learnrate=str2double(get(hObject,'String'));
if(isnan(learnrate))
errordlg('请输入学习速率');
end
user_data.learnrate=learnrate;
set(gcf,'userdata',user_data);
% --- Executes during object creation, after setting all properties.
function edit_learnrate_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_learnrate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
user_data=get(gcf,'userdata');
learnrate=str2double(get(hObject,'String'));
user_data.learnrate=learnrate;
set(gcf,'userdata',user_data);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -