File: convolve.inp

package info (click to toggle)
gretl 2022c-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,552 kB
  • sloc: ansic: 409,074; sh: 4,449; makefile: 3,222; cpp: 2,777; xml: 599; perl: 364
file content (15 lines) | stat: -rw-r--r-- 284 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# define two polynomials
a = { 1, 0.5,    0, 0 }'
b = { 1, 0.3, -0.8, 0 }'
# perform the transforms
f = fft(a ~ b)
# complex-multiply the two transforms 
fc = cmult(f[,1:2], f[,3:4]) 
print fc
# compute the coefficients of c = a * b via the inverse transform
c = ffti(fc)
print c