728x90 Quality control (Univ. Study)/Signal and System1 Signal and System approximate computing 1번 문제 소스코드 import math #삼각함수와 pi를 이용하기 위해 math 모듈 import import matplotlib.pyplot as plt #pip install matplotlib을 통하여 미리 module install N = int(input()) #예삿값을 구하기 위한 N을 입력 t = 0 graph = [] #빈 리스트 생성 def sigma(t): #x_hat_n(t)의 결과를 구하는 sigma 함수 정의 n = 1 #n -> 1~N sum = 0.0 while n < N: #n이 N보다 작은 경우에 sum += (4.0 / math.pi) * (1 / n) * math.sin(n * math.pi * float(t)) #x(t)식 계산 n += 2 #n에 홀수값 대입 re.. 2022. 11. 6. 이전 1 다음 728x90