永发信息网

matlab rands函数问题

答案:2  悬赏:20  手机版
解决时间 2021-01-27 10:25
[W1,B1]=rands(2,2)
??? Error using ==> rands
Too many output arguments.
这个是怎么回事呢
最佳答案
只能返回一个参数
全部回答
这个问题和神经元算法实现有关。 你看一下程序的源代码,注意看最下下面标出的那两行: function [w,b] = rands(s,pr) %rands symmetric random weight/bias initialization function. % % syntax % % w = rands(s,pr) % m = rands(s,r) % v = rands(s); % % description % % rands is a weight/bias initialization function. % % rands(s,pr) takes, % s - number of neurons. % pr - rx2 matrix of r input ranges. % and returns an s-by-r weight matrix of random values between -1 and 1. % % rands(s,r) returns an s-by-r matrix of random values. % rands(s) returns an s-by-1 vector of random values. % % examples % % here three sets of random values are generated with rands. % % rands(4,[0 1; -2 2]) % rands(4) % rands(2,3) % % network use % % to prepare the weights and the bias of layer i of a custom network % to be initialized with rands: % 1) set net.initfcn to 'initlay'. % (net.initparam will automatically become initlay's default parameters.) % 2) set net.layers{i}.initfcn to 'initwb'. % 3) set each net.inputweights{i,j}.initfcn to 'rands'. % set each net.layerweights{i,j}.initfcn to 'rands'; % set each net.biases{i}.initfcn to 'rands'. % % to initialize the network call init. % % see also randnr, randnc, initwb, initlay, init % mark beale, 1-31-92 % revised 12-15-93, mb % revised 11-31-97, mb % copyright 1992-2008 the mathworks, inc. % $revision: 1.1.6.7 $ $date: 2008/06/20 08:04:33 $ fn = mfilename; if (nargin < 1), error('nnet:arguments','not enough arguments.'); end if ischar(s) switch(s) case 'name' w = 'midpoint'; otherwise, error('nnet:arguments',['unrecognized code: ''' s '''']) end return end if nargin == 1 r = 1; elseif size(pr,2) == 1 r = pr; else r = size(pr,1); end w = 2*rand(s,r)-1;//看着个地方 % **[ nnt2 support ]** if nargout == 2 b = 2*rand(s,1)-1; //看着个地方 end])
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
美妙的时间总要我们彼此歌词后面还有谢谢你让
程序员其实是不是一份好工作?
小羚羊电动车怎么一开电门不用插钥匙就可以加
抽脂了一个月可以喝咖啡吗
辟知方塘这成语是什么意思
廐苑的意思是什么啊?知道的请说下!
朝阳区富博汽车服务中心旗舰店地址在哪,我要
纤丽菓代言人是谁?
ASP.NET(c#)获取Master页面变量
联想e540用u盘重装系统
水泥混凝土路面的养护时间宜为()d。A.14~21B
签助的意思是什么啊?知道的请说下!
一套护肤品有几瓶啊?
Biodiversity(生物多样性), or biological di
汽车打孔真皮里面有脏东西如何清理
推荐资讯
(7分)阅读下列材料:材料一? 西汉文帝、景
红米note开不开机,电脑也连不上,就连充电也
洋洋发屋地址在哪,我要去那里办事
水蛇腰的意思是什么啊?知道的请说下!
哈尔滨 羊肉多钱一斤 夜市 商店都多少?
喝醉酒有什么坏处吗
什么词语来形容一个人做事一点都不行
芦荟胶适合每天都用吗?
中国移动(断石营业厅)地址在哪,我要去那里办
1molFe、P、Mg、S在氧气中完全燃烧消耗氧气的
明德教育(北京平谷)怎么去啊,我要去那办事
为什么汽车后视镜里的车不是左右相反的?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?