sábado, 6 de julio de 2019
RED NEURONAL (TAREA)
IMPLEMENTACIÓN DE LA RED NEURONAL
(Tarea: Explicar su funcionamiento e incluir el diagrama de flujo de los dos programas de cada Arduino). Fecha de entrega 13 de julio 2019.
Extraído de la URL: https://www.youtube.com/watch?v=cWGgPjzkN10&t=0s
void setup() {
Serial.begin(9600);
}
void loop() {
int val1 = digitalRead(3);
int val2 = digitalRead(4);
double REDOR1 = RED(0.4836, 0.4354, 0.5640,val1,val2);
Serial.println(REDOR1,4);
delay(100);
}
double ConvEntrada1(double x){
double max = 1;
double min = -1;
double xmax = 1;
double xmin = 0;
double Scala = (max - min)/(xmax - xmin)*(x - xmin) + min;
return Scala;
delay(10);
}
double ConvEntrada2(double x){
double max = 1;
double min = -1;
double xmax = 1;
double xmin = 0;
double Scala = (max - min)/(xmax - xmin)*(x - xmin) + min;
return Scala;
}
double ConvSalida(double x){
double max = 3;
double min = 0;
double xmax = 1;
double xmin = -1;
double Scala = (max - min)/(xmax - xmin)*(x - xmin)+ min;
return Scala;
delay(10);
}
double RED (double w1, double w2, double bias, double Ent1, double Ent2){
double Entrada1=ConvEntrada1(Ent1);
double Entrada2=ConvEntrada2(Ent2);
double Z = w1*Entrada1 + w2*Entrada2 + bias;
double Salida = ConvSalida(Z);
return Salida;
delay(10);
}