📄 bpnet.m
字号:
switch popup_sel case 1 msgbox('请选择隐含层到输出层的传递函数!','错误') % 提示用户正确选择隐含层到输出层的传递函数 case 2 TF2='tansig'; % 设置隐含层到输出层的传递函数为tansig case 3 TF2='logsig'; % 设置隐含层到输出层的传递函数为logsig case 4 TF2='dtansig'; % 设置隐含层到输出层的传递函数为dtansig case 5 TF2='dlogsig'; % 设置隐含层到输出层的传递函数为dlogsigend;% --- Executes during object creation, after setting all properties.function popupmenu2_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in popupmenu3.function popupmenu3_Callback(hObject, eventdata, handles)% hObject handle to popupmenu3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu3global BTFpopup_sel=get(handles.popupmenu3,'Value');switch popup_sel case 1 msgbox('请选择训练函数!','错误'); % 提示用户正确选择训练函数 case 2 BTF='traingd'; % 设置训练函数为traingd case 3 BTF='traingdm'; % 设置训练函数为traingdm case 4 BTF='traingda'; % 设置训练函数为traingda case 5 BTF='traingdx'; % 设置训练函数为traingdx case 6 BTF='trainlm'; % 设置训练函数为trainlmend;% --- Executes during object creation, after setting all properties.function popupmenu3_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction 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 doubleglobal Epochsedit3_value=str2double(get(handles.edit3,'string'));if (edit3_value>0)&&(edit3_value==round(edit3_value)) % 判断输入的训练步数是否正确 Epochs=edit3_value;else msgbox('输入错误,请输入正整数!','错误'); % 提示用户输入错误end;% --- 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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (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 edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a doubleglobal Goaledit4_value=str2double(get(handles.edit4,'string')); % 判断输入的训练目标是否正确if (edit4_value>0)&&(edit4_value<1) Goal=edit4_value;else msgbox('输入错误,请输入0至1之间的小数!','错误'); % 提示用户输入错误end;% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (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 edit5 as text% str2double(get(hObject,'String')) returns contents of edit5 as a doubleglobal Showedit5_value=str2double(get(handles.edit5,'string'));if (edit5_value>0)&&(edit5_value==round(edit5_value)) % 判断输入的显示间隔是否正确 Show=edit5_value;else msgbox('输入错误,请输入正整数!','错误'); % 提示用户输入错误end;% --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (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 edit6 as text% str2double(get(hObject,'String')) returns contents of edit6 as a doubleglobal Lredit6_value=str2double(get(handles.edit6,'string'));if (edit6_value>0.01)&&(edit6_value<0.2) % 判断输入的学习速率是否正确 Lr=edit6_value;else msgbox('建议输入0.01至0.2之间的小数!','警告'); % 警告用户输入超出建议范围end;% --- Executes during object creation, after setting all properties.function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle to edit6 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- 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)set([handles.edit1,handles.edit2,handles.edit3,handles.edit4,handles.edit5,handles.edit6],'String',[]);set([handles.popupmenu1,handles.popupmenu2,handles.popupmenu3],'Value',1);% 初始化神经网络参数% --- Executes on selection change in listbox1.function listbox1_Callback(hObject, eventdata, handles)% hObject handle to listbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array% contents{get(hObject,'Value')} returns selected item from listbox1set(handles.listbox2,'Value',get(handles.listbox1,'Value')); % 定位输入数据在输出数据中的对应项% --- Executes during object creation, after setting all properties.function listbox1_CreateFcn(hObject, eventdata, handles)% hObject handle to listbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in listbox2.function listbox2_Callback(hObject, eventdata, handles)% hObject handle to listbox2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns listbox2 contents as cell array% contents{get(hObject,'Value')} returns selected item from listbox2set(handles.listbox1,'Value',get(handles.listbox2,'Value')); % 定位输出数据在输入数据中的对应项% --- Executes during object creation, after setting all properties.function listbox2_CreateFcn(hObject, eventdata, handles)% hObject handle to listbox2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in listbox3.function listbox3_Callback(hObject, eventdata, handles)% hObject handle to listbox3 (see GCBO)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -