티스토리 뷰


AND게이트의 진리표이다. 입력신호 x1, x2가 둘 다 1 이어야 1을 출력한다.



1
2
3
4
5
6
7
8
9
10
11
def AND(x1,x2): //insert x1, x2
 
 w1, w2, theta = 0.5,0.5,0.7 //x1,x2의 가중치, 임계값 설정
 tmp = x1*w1 + x2*w2
 
 if tmp <= theta:
    return 0
 
elif tmp > theta:
    return 1
   
cs





OR 게이트의 진리표이다. x1, x2중 1이 하나라도 있으면 1을 출력한다.



1
2
3
4
5
6
7
8
9
def OR(x1,x2): 
 
    w1, w2, theta = 0.50.5 ,0.3
    tmp = x1*w1 + x2*w2
    if tmp <= theta:
       return 0
    elif tmp > theta:
       return 1
   
cs


                                       


                                          


      

                                                 

NAND 게이트는 0이 하나라도 있으면 1을 출력한다.




1
2
3
4
5
6
7
8
9
def NAND(x1,x2): 
 
    w1, w2, theta = -0.5-0.5 ,-0.7
    tmp = x1*w1 + x2*w2
    if tmp <= theta:
       return 0
    elif tmp > theta:
       return 1
   
cs



사진은 http://saruchi.egloos.com/2084955 여기서 퍼왔음 ^

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함