double logistic(double x){ if(x > 100.0) x = 1.0; else if (x < -100.0) x = 0.0; else x = 1.0/(1.0+exp(-x)); return x;}void ComputeFeedForwardSignals(double* MAT_INOUT,double* V_IN,double* V_OUT, double* V_BIAS,int size1,int size2,int layer){ int row,col; for(row=0;row < size2; row++) { V_OUT[row]=0.0; for(col=0;col<size1;col++)V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)*V_IN[col]); V_OUT[row]+=V_BIAS[row]; if(layer==0) V_OUT[row] = tanh(V_OUT[row]); if(layer==1) V_OUT[row] = logistic(V_OUT[row]); }}
MATLAB: How to convert C++ code into Matlab. How to write the below given part of code into matlab
logistic
Best Answer