MATLAB Answers

the following code is to get neural network output in term of weights and biases for one single output how i can rewirte the code for neural network with 2 outputs

1 view (last 30 days)
Mary Abdu
Mary Abdu on 27 Dec 2018
Commented: VBBV on 1 Feb 2021
L=length(outputs);
for i=1:L
x=inputs(:,i);
y1=w1*x+b1;
y1=tansig(y1);
y22=w2*y1+b2;
y2(i)=purelin(y22);
end

Answers (2)

Mary Abdu
Mary Abdu on 28 Dec 2018
Edited: madhan ravi on 28 Dec 2018
i tried with the below code but stil not work could anyone help me please:
[r,c]=size(outputs);
for i=1:r
for j=1:c
x=inputs(:,j);
Y1=w1*in+b1;
Y1=tansig(Y1);
Y11a=w2(1,:)*Y1+b2(1,:);
Y2a(1:j)=purelin(Y11a);
Y11b=w2(2,:)*Y1+b2(2,:);
Y2b(2:j)=purelin(Y11b);
end
end

VBBV
VBBV on 31 Jan 2021
Y11a=w2(1,:)*Y1+b2(1,:); % A vector of values
Y2a(1:j)=purelin(Y11a); % Y11a is a vector
Y11b=w2(2,:)*Y1+b2(2,:); % ... vector of values
Y2b(2:j)=purelin(Y11b); % Y11b is also vector
You are trying to use Y11a and Y11b as indices of function purelin... which will likely throw errors
  2 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!