Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- STa = float(input('Stopband Attenuation: '))
- fc = 1.5
- delF = 0.5
- sF = 8
- Fcc = fc + (delF / 2) / sF
- Wn1 = np.zeros(27)
- Wn2 = np.zeros(27)
- Wn3 = np.zeros(27)
- H = np.zeros(27)
- Hd = np.zeros(27)
- Hans = np.zeros(53)
- Hd[0] = 2 * Fcc
- Wn1[0] = 0.5 + 0.5 * np.cos(0)
- Wn2[0] = 0.54 + 0.46 * np.cos(0)
- Wn3[0] = 1
- H[0] = Hd[0] * Wn2[0]
- for n in range(26):
- Hd[n+1] = (np.sin(2 * np.pi * Fcc * (n+1))) / (np.pi * (n+1))
- if 21 < STa <= 44:
- for n in range(26):
- Wn1[n+1] = 0.5 + 0.5 * np.cos((2 * np.pi * (n+1)) / 53)
- H[n+1] = Hd[n+1] * Wn1[n+1]
- if 44 < STa <= 53:
- for n in range(26):
- Wn2[n+1] = 0.54 + 0.46 * np.cos((2 * np.pi * (n+1)) / 53)
- H[n+1] = Hd[n+1] * Wn2[n+1]
- if STa <= 21:
- for n in range(26):
- Wn3[n+1] = 1
- H[n+1] = Hd[n+1] * Wn3[n+1]
- Hans[:27] = H[::-1]
- Hans[27:] = H[1:]
- for f in range(1, 54):
- print(f'h({f-1}): {Hans[f-1]:.4e}')
Advertisement
Add Comment
Please, Sign In to add comment