# -*- coding: utf-8 -*-
"""
Created on Sun Mar  9 20:52:42 2025

@author: AKourgli
"""

import numpy as np
import matplotlib.pyplot as plt

# Définition de l'intervalle temporel
t = np.linspace(-5, 5, 1000)
sinc1 = 1 * np.sinc(t / 1.0)
sinc2 = 1 * np.sinc((t - 1) / 1.0)
sinc3 = 1 * np.sinc((t + 1) / 1.0)
sinc4 = 1 * np.sinc((t + 2) / 1.0)
sinc5 = 1 * np.sinc((t - 2) / 1.0)
result = sinc1 - sinc2 + sinc3 + sinc4 -sinc5


# Tracé des résultats
plt.figure()
plt.plot(t, sinc1, 'b--', alpha=0.5, label='Sinc 1 (base)')
plt.plot(t, sinc2, 'g--', alpha=0.5, label='Sinc 2')
plt.plot(t, sinc3, 'r--', alpha=0.5, label='Sinc 3')
plt.plot(t, sinc4, 'y--', alpha=0.5, label='Sinc 4')
plt.plot(t, sinc5, 'y--', alpha=0.5, label='Sinc 5')
plt.plot(t, result, 'k-', linewidth=2, label='Somme totale')

plt.title('Somme de cinq fonctions sinus cardinal')
plt.xlabel('Temps')
plt.ylabel('Amplitude')
plt.grid(True)
plt.legend()
plt.xlim(-5, 5)
plt.show()