728x90
월별 사인 코사인 시각화
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'Malgun Gothic'
# 월 데이터를 생성 (1월부터 12월까지)
months = np.arange(1, 13)
# 사인과 코사인 변환
sin_month = np.sin(2 * np.pi * months / 12)
cos_month = np.cos(2 * np.pi * months / 12)
plt.figure(figsize=(8, 8))
plt.scatter(cos_month, sin_month, color='blue')
# 각 월을 표시
for i, month in enumerate(months):
plt.text(cos_month[i]*1.1, sin_month[i]*1.1, f'{month}월',
horizontalalignment='center', verticalalignment='center')
# 원형 그리기
circle = plt.Circle((0, 0), 1, color='black', fill=False, linestyle='--')
plt.gca().add_artist(circle)
# 축 설정
plt.xlabel('Cosine')
plt.ylabel('Sine')
plt.title('월별 사인-코사인 변환 시각화')
plt.grid(True)
plt.axis('equal') # x축과 y축의 스케일을 동일하게 설정
plt.show()
plt.figure(figsize=(12, 6))
# 사인 값 선 그래프
plt.plot(months, sin_month, marker='o', label='Sin(month)')
# 코사인 값 선 그래프
plt.plot(months, cos_month, marker='s', label='Cos(month)')
# 월 표시
plt.xticks(months, [f'{month}월' for month in months])
# 그래프 제목 및 축 레이블
plt.title('월별 사인 및 코사인 변환 시각화')
plt.xlabel('월')
plt.ylabel('변환 값')
# 범례 추가
plt.legend()
# 그리드 추가
plt.grid(True)
# y축 범위 설정 (-1.1 to 1.1) 사인과 코사인 함수의 범위
plt.ylim(-1.1, 1.1)
plt.show()
728x90
'09_DL(Deep_Learning)' 카테고리의 다른 글
05_다중분류(Iris) (0) | 2025.04.23 |
---|---|
04_신경망 모델 훈련 도구 (1) | 2025.04.23 |
03_다층 인공신경망 (0) | 2025.04.18 |
02_단층 인공신경망 (1) | 2025.04.18 |
01_퍼셉트론 구조 (0) | 2025.04.18 |