summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/various/FFT_tests.cir
blob: e7ede5ec4c45ddd7ec37544f1293bde1feda600e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
FFT_tests http://www.idea2ic.com/
.control
set units=degrees
let a = vector(16)
*plot a vs a
set pensize = 2
*=========Need_a_complex_input====================
let ac = a+j(0)
print a ac
*plot fft(a) vs a
*plot real(fft(ac)) imag(fft(ac)) vs a
* fft(a) fft(ac)

*=========DC_Works====================
let b = unitvec(16)
let bc = b+j(0)
*plot fft(b) vs a                             title DC_WORKS
*print fft(b) fft(bc)

*=========DC_Plus_cos_Remove_AC====================
let     numb = length(b)
print   numb

let     indx = 0
repeat  $&numb
let     ac[indx]= cos(indx*360/8)+1 +j(0)
let     indx = indx +1
end

let     fftac=fft(ac)
plot    real(fftac)          imag(fftac)  vs a   title DC_Plus_COS

let     fftac[2]=(0,0)
let     fftac[14]=(0,0)
let     ifftac = ifft(fftac)
plot    ifftac ac vs a                        title COS_REMOVED

*=========DC_Plus_cos_Remove_DC====================
let     indx = 0
repeat  $&numb
let     ac[indx]= cos(indx*360/8)+1 +j(0)
let     indx = indx +1
end

let     fftac=fft(ac)
let     fftac[0]=(0,0)
let     ifftac = ifft(fftac)
plot    ifftac ac  vs a                       title COS_With_DC_REMOVED

*=========DC_Plus_sin_Remove_AC====================
let indx = 0
repeat $&numb
let ac[indx]= sin(indx*360/8)+1 +j(0)
let indx = indx +1
end

let fftac=fft(ac)
plot real(fftac) imag(fftac)  vs a           title DC_Plus_SIN

let fftac[2]=(0,0)
let fftac[14]=(0,0)
let ifftac = ifft(fftac)
plot ifft(fftac) ac  vs a                       title SIN_REMOVED

*=========DC_Plus_sin_Remove_DC====================
let indx = 0
repeat $&numb
let ac[indx]= sin(indx*360/8)+1 +j(0)
let indx = indx +1
end

let fftac=fft(ac)
let fftac[0]=(0,0)
let ifftac = ifft(fftac)
plot ifft(fftac) ac  vs a                        title SIN_With_DC_REMOVED

*=========DC_Plus_cos_Nyqusit_Remove_DC====================
let indx = 0
repeat $&numb
let ac[indx]= cos(indx*360/2)+1 +j(0)
let indx = indx +1
end

plot ac vs a                                 title Nyq_COS

let fftac=fft(ac)
plot real(fftac)  imag(fftac)  vs a           title Nyq_FREQ_COS
let fftac[0]=(0,0)
let ifftac = ifft(fftac)
plot ifft(fftac) ac  vs a                       title COS_With_DC_REMOVED
*=========DC_Plus_sin_Nyqusit_Remove_DC====================
let indx = 0
repeat $&numb
let ac[indx]= sin(indx*360/2)+1 +j(0)
let indx = indx +1
end

plot ac vs a                                title Nyq_SIN

let fftac=fft(ac)
plot real(fftac)  imag(fftac)  vs a         title Nyq_FREQ_SIN
let fftac[0]=(0,0)
let ifftac = ifft(fftac)
plot ifft(fftac)  ac vs a                      title COS_With_DC_REMOVED

*=========DC_Plus_COS_Remove_One_BIN====================
let indx = 0
repeat $&numb
let ac[indx]= cos(indx*360/8)+1 +j(0)
let indx = indx +1
end

let fftac=fft(ac)
let fftac[2]=(0,0)
plot real(fftac) imag(fftac)  vs a             title DC_Plus_Cos

let ifftac = ifft(fftac)
plot ifft(fftac) ac  vs a                       title ONE_BIN_REMOVED

plot real(ifft(fftac)) imag(ifft(fftac))   vs a      title ONE_BIN_REMOVED

.endc
.end