MATLAB Answers

0

Simulate neural network with a new signal

Asked by João Queiroz on 14 Jul 2019
Hello everyone.
I'm new in NN stuff and I've got a problem.
I want to simulate a new signal in my net, but not using the command "SIM". I want use the product of matrices. So when i compare the final result using the funcion "SIM" and my script the numbers are diferents.
my neural network:
my scrip for simulate a new signal and get the output:
%#######################################################
Iw = net.IW; %the input-to-hidden layer weights
weights_input = Iw{1,1}';
Lw = net.Lw; %the hidden-to-output layer weights
weights_output = Lw{2,1};
b1 = net.b(1); %the input-to-hidden layer bias
Bias_1 = b1{1,1}';
b2 = net.b(2); %the hidden-to-output layer bias
Bias_2 = b2{1,1}';
clear Iw Lw b1 b2
%#######################################################
x = 1; %neurons
for i = 1:x %neurons
M(:,i) = Signal.*weights_input(:,i);
end
for i = 1:x
S(:,i) = sum(M(:,i)) + Bias_1(:,i);
end
for i = 1:x
Output_1(:,i) = tansig(S(:,i)); %####################
end
%######################################
%Output layer
for i = 1:1 %neurons
M_1(:,i) = Output_1.*weights_output(i,:);
end
for i = 1:1
S_1(:,i) = sum(M_1(:,i)) + Bias_2(:,i);
end
Output_Final = logsig(S_1');

  0 Comments

Sign in to comment.

0 Answers