getting error "Undefined function or method 'logistic' for input arguments of type 'double'.""

1 次查看(过去 30 天)
I have written a code based on neural network and when I ma trying to run code getting error as "Undefined function or method 'logistic' for input arguments of type 'double'" I have given the portion of code where getting error.
double logistic(x)
if(x > 100.0)
x = 1.0;
else if (x < -100.0)
x = 0.0;
else x = 1.0/(1.0+exp(-x));
x;
end
end
function [V_OUT]= feed_forward_signals(MAT_INOUT, V_IN, V_OUT, V_BIAS, size1, size2, layer)
for row = 1:size2
V_OUT(row)=0;
for col = 1:size1
V_OUT(row)=V_OUT(row)+MAT_INOUT(row,col)*V_IN(col);
end
V_OUT(row)=V_OUT(row)+V_BIAS(row);
end
if(layer==0)
V_OUT(row) = tanh(V_OUT(row));
end
if(layer==1)
V_OUT(row) = logistic(V_OUT(row));
please help
end

采纳的回答

Greg Heath
Greg Heath 2015-6-29
If you have the Neural Network Toolbox just use
LOGSIG or TANSIG
otherwise, just use TANH.
Also see
Subject: NEURAL NET TRAINING SPEED USING A MODIFIED ELLIOT SIGMOID
From: Greg Heath
Date: 14 Oct, 2012 06:18:08
Hope this helps.
Thank you for formally accepting my answer
Greg
  2 个评论
vandana
vandana 2015-6-30
Hi, thanks for your reply. but does LOGSIG or TANSIG functions will give the same results as logistic. because I am getting good results with logistic function only. TANH is not giving good results.
Greg Heath
Greg Heath 2015-6-30
[x,t] = simplefit_dataset;
z = [ x; t];
1. TANSIG is MATLAB's version of TANH.
y1 = tansig(z);
y2 = tanh(z);
>> ans = minmax(y1-y2)
ans = -3.3307e-16 3.3307e-16
-3.3307e-16 3.3307e-16
2. LOGSIG is MATLAB's version of the LOGISTIC.
3. It has been demonstrated in the comp.ai.neural-nets FAQ that tansig hidden nodes are better than logsig when inputs have zero mean.
Neural Network FAQ, part 1 of 7: Introduction - SAS
ftp://ftp.sas.com/pub/neural/FAQ.html
Hope this helps.
Greg

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by