matlab中m文件的好处,请教matlab中M文件问题?
第一次运行时> 提示 function_name(load('c:\6.txt'),load('c:\5.txt'),'10000','1e-6');
??? Error using ==> function_name
Too many input arguments.
我将P,T两个参数去掉,将里面算法去掉一个,直接计算其中一个,可以算出一些值,不过MSE的值还是没法求出来,帮我看看是哪里出了问题,谢谢,下面是我改的,还有错误提示
function MSE = function_name(epochs, goal)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NEWFF——生成一个新的前向神经网络
% TRAIN——对 BP 神经网络进行训练
% SIM——对 BP 神经网络进行仿真
% 定义训练样本
% P 为输入矢量
% fid 为文件名
P=load('c:\6.txt');
T=load('c:\5.txt');
P=P';
T=T';
[PN,minp,maxp,TN,mint,maxt] = premnmx(P,T)
% 对数据进行预处理,进行归一化处理
rand('state',0)
net=newff(minmax(PN),[15,1],{'tansig','purelin'})
% 创建一个新的前向神经网络
%clc
% disp('1. L-M 优化算法 TRAINLM');
% disp('2. 弹性梯度下降法 TRAINRP');
% choice=input('请选择训练算法(1,2):');
% figure(gcf);
% if(choice==1)
% 采用 L-M 优化算法 TRAINLM
net.trainFcn='trainlm';
% 设置训练参数
net.trainParam.epochs = epochs; %%%%%%%%%%%%%%%%%
net.trainParam.goal = goal; %%%%%%%%%%%%%%%%%%%%
net=init(net);
% 重新初始化
% elseif(choice==2)
% 采用弹性梯度下降法 TRAINRP
% net.trainFcn='trainrp';
% 设置训练参数
% net.trainParam.epochs = epochs; %%%%%%%%%%%%%%%%%%%%
% net.trainParam.goal = goal; %%%%%%%%%%%%%%%%%%%%%%%
% net = init(net);
% 重新初始化
% end
% 调用相应算法训练 BP 网络
[net,tr]=train(net,PN,TN);
inputWeights=net.IW{1,1}
inputbias=net.b{1}
layerWeights=net.LW{2,1}
layerbias=net.b{2}
% 对 BP 网络进行仿真
AN = sim(net,PN);
% 计算仿真误差
[A] = postmnmx(AN,mint,maxt);
% 恢复用premnmx处理过的数据
E = T - A;
MSE=mse(E);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
这个事输入命令的 MSE=function_name('10000','1e-6');
以下是错误提示
Warning: PREMNMX is an obsolete function.
> In nntobsf at 18
In premnmx at 20
In function_name at 15
Use MAPMINMAX instead, type HELP PREMNMX for bug warning.
PN =
Columns 1 through 12
0.5327 1.0000 0.2570 0.4673 -0.6215 -0.0654 0.0537 -0.7033 -0.3925 -0.9533 0.2150 0.6402
0.8730 0.6825 -0.0476 1.0000 0.1429 0.4921 0.2063 0.1111 -0.2381 -1.0000 0.5238 0.9683
-0.0947 -0.8947 0.5579 -0.9158 0.1789 -0.5368 -0.3474 -0.9368 0.6211 1.0000 -1.0000 -1.0000
Columns 13 through 19
-1.0000 0.1308 -0.2780 -0.5561 0.2033 0.3598 0.5023
-0.8413 0.4603 0.3968 -0.1746 0.0159 0.0476 0.4286
0.5789 -0.1579 -0.8526 -0.3474 -0.3263 0.7474 -0.2211
minp =
10.6000
14.2000
61.0000
maxp =
19.1600
20.5000
156.0000
TN =
Columns 1 through 12
0.8751 -0.0831 0.6589 -0.1705 -0.0956 -0.0342 -0.1495 -1.0000 0.1162 -0.4775 -0.5833 -0.2269
Columns 13 through 19
-0.5137 0.2477 -0.6730 -0.6198 -0.1499 1.0000 0.3701
mint =
9.3408
maxt =
27.8640
Warning: NEWFF used in an obsolete way.
> In nntobsu at 18
In newff at 105
In function_name at 18
See help for NEWFF to update calls to the new argument list.
net =
Neural Network object:
architecture:
numInputs: 1
numLayers: 2
biasConnect: [1; 1]
inputConnect: [1; 0]
layerConnect: [0 0; 1 0]
outputConnect: [0 1]
numOutputs: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)
subobject structures:
inputs: {1x1 cell} of inputs
layers: {2x1 cell} of layers
outputs: {1x2 cell} containing 1 output
biases: {2x1 cell} containing 2 biases
inputWeights: {2x1 cell} containing 1 input weight
layerWeights: {2x2 cell} containing 1 layer weight
functions:
adaptFcn: 'trains'
divideFcn: (none)
gradientFcn: 'calcjx'
initFcn: 'initlay'
performFcn: 'mse'
trainFcn: 'trainlm'
parameters:
adaptParam: .passes
divideParam: (none)
gradientParam: (none)
initParam: (none)
performParam: (none)
trainParam: .epochs, .goal, .max_fail, .mem_reduc,
.min_grad, .mu, .mu_dec, .mu_inc,
.mu_max, .show, .time
weight and bias values:
IW: {2x1 cell} containing 1 input weight matrix
LW: {2x2 cell} containing 1 layer weight matrix
b: {2x1 cell} containing 2 bias vectors
other:
userdata: (user information)
??? Error using ==> trainlm at 202
Epochs is not a positive integer.
Error in ==> network.train at 300
[net,tr,Ac,El] = feval(net.trainFcn,net,Pd,Tl,Ai,Q2,TS2,VV,TV);
Error in ==> function_name at 44
[net,tr]=train(net,PN,TN);
matlab中m文件的好处,请教matlab中M文件问题?相关推荐
- matlab的求实部,[合集]请教matlab中复数除法如何求实部虚
发信人: Casper (A WAVELET OF ZOMBIES IS APPROACHING!), 信区: MathTools 标 题: [合集]请教matlab中复数除法如何求实部虚部 发信站 ...
- matlab中并行用不了,请教matlab在linux下的并行问题 - 程序语言 - 小木虫 - 学术 科研 互动社区...
刚在网上搜了一下,matlabpool open local 8 设置节点数,但是必须在matlab下面才行,比如我打开linux, >>matlab 进入matlab系统,然后matla ...
- 如何读取服务器的文件夹大小,请教如何获取outlook文件夹对话框中服务器数据大小?...
Hi, 感谢你在MSDN发帖. 对于这篇文章,我认为可以这么理解. 如果你想获取服务器上面的文件夹的大小,outlook通常使用IMsgStore::OpenEntry 这个方法并且使用MAPI_NO ...
- jsp mysql 图片路径,请教JSP中怎么向MySql中存入和取出图片
当前位置:我的异常网» Java Web开发 » 请教JSP中怎么向MySql中存入和取出图片 请教JSP中怎么向MySql中存入和取出图片 www.myexceptions.net 网友分享于:2 ...
- matlab中m文件的作用,M文件主要包含()_matlab中m文件的好处
M文件主要包含() 答:M函数文件\n\nM命令文件(脚本文件) " src=" " style="max-width: 100%; display: inli ...
- matlab 十六进制数组,【MATLAB】MATLAB中读取二进制数据文件并加入到矩阵中
MATLAB中读取二进制数据文件并加入到矩阵中的应用如下: 如果对c语言十分熟悉的话,应该对fopen,fclose,ftell,fseek,fread,fwrite,feof 这些函数非常熟悉了,在 ...
- matlab中读文件的行数_Matlab中读取txt文件的几种方法
Matlab中读取txt文件的几种方法 一.纯数据文件(没有字母和中文,纯数字) 对于这种txt文档,从matalb中读取就简单多了 例如test.txt文件,内容为"17.901 -1.1 ...
- Matlab打开文件替换变量,读取matlab某个路径下的“.mat”文件,改变文件中的内容,并以原名字,变量保存...
close all clear all clc matList=dir('*.mat');%寻找当前路径下的'.mat'文件 numberofMat=length(matList);%查看" ...
- python读取matlab数据_详解如何在python中读写和存储matlab的数据文件(*.mat)
背景 在做deeplearning过程中,使用caffe的框架,一般使用matlab来处理图片(matlab处理图片相对简单,高效),用python来生成需要的lmdb文件以及做test产生结果.所以 ...
最新文章
- [hdu1847]博弈,推理
- html连在一起的选择器,请问关于css选择器的问题:两个类选择器连在一起是什么意思?...
- Linux C中发现无法连接到math.h中的数学函数解决办法
- C++第二次上机5-5
- 【Proteus仿真】220V转5V向单片机供电
- 高端存储器研发再获突破 集成电路国产化进程加快
- Container的限制
- Java使用OpenOffice实现Office系列文件转Pdf
- 手把手教你架构3D引擎高级篇系列四
- 计算机软件工程职业道德论文,软件工程职业道德论文_软件工程_软件工程就业前景...
- VC++制作连连看辅助经验分享
- 互联网热门词汇搞笑来袭
- 封存了一年的网络编程笔记
- 使用pycharm出现黄色框的情况
- 数学形态学之腐蚀算法
- 解决mac BigSur外接显示器发白、发黄、字体发虚 (OpenCore关闭SIP和Read-Only System)
- 对于大型公司项目平台选择j2ee的几层认识(二)
- 前端学习笔记(一)HTML5
- A-Level真题每期一练(11)
- vue笔记+渡一教育第一章整理