
Input #1, X
rek(i) = x
Next i
For i = 1 To 80
Input #2, y
imk(i) = y
Next i
For i = 1 To 80
w = 2 * 3.1415926 * (i - 1) / 80
x = 0: y = 0
For j = 1 To 80
wcos = Cos(w * (j - 1))
wsin = Sin(w * (j - 1))
x = x + rek(j) * wcos + imk(j) * wsin
y = y + imk(j) * wcos - rek(j) * wsin
Next j
a = Int(x * 32768 / 80)
reg(i) = a
img(i) = y
Next i
For j = 1 To 79
Print #3, reg(j); ","
Next j
For j = 80 To 80
Print #3, reg(j); ";"
Next j
For j = 1 To 80
Print #4, USING; "###.######"; img(j)
Next j
Close
Print "OK"
End
№ |
Re |
Im |
|
№ |
Re |
Im |
1 |
4014 , |
-0.000000 |
|
41 |
160 , |
0.000002 |
2 |
2232 , |
-0.000001 |
|
42 |
85 , |
0.000001 |
3 |
-751 , |
-0.000000 |
|
43 |
-27 , |
-0.000000 |
4 |
-2984 , |
-0.000002 |
|
44 |
-90 , |
-0.000000 |
5 |
-3197 , |
0.000003 |
|
45 |
-75 , |
-0.000000 |
6 |
-1599 , |
-0.000003 |
|
46 |
-26 , |
0.000000 |
7 |
479 , |
0.000001 |
|
47 |
3 , |
-0.000000 |
8 |
1689 , |
0.000003 |
|
48 |
3 , |
0.000000 |
9 |
1581 , |
-0.000003 |
|
49 |
0 , |
0.000000 |
10 |
678 , |
0.000001 |
|
50 |
6 , |
0.000000 |
11 |
-171 , |
-0.000001 |
|
51 |
-7 , |
-0.000000 |
12 |
-481 , |
-0.000000 |
|
52 |
-60 , |
-0.000002 |
13 |
-339 , |
-0.000001 |
|
53 |
-113 , |
-0.000003 |
14 |
-98 , |
-0.000001 |
|
54 |
-89 , |
-0.000002 |
15 |
12 , |
0.000000 |
|
55 |
39 , |
0.000001 |
16 |
9 , |
-0.000000 |
|
56 |
195 , |
0.000003 |
17 |
1 , |
-0.000000 |
|
57 |
248 , |
0.000003 |
18 |
13 , |
0.000000 |
|
58 |
141 , |
0.000001 |
19 |
-14 , |
-0.000000 |
|
59 |
-46 , |
-0.000000 |
20 |
-103 , |
0.000000 |
|
60 |
-166 , |
-0.000000 |
21 |
-174 , |
-0.000001 |
|
61 |
-148 , |
0.000000 |
22 |
-122 , |
-0.000000 |
|
62 |
-54 , |
0.000000 |
23 |
48 , |
0.000000 |
|
63 |
8 , |
-0.000000 |
24 |
212 , |
-0.000000 |
|
64 |
7 , |
-0.000000 |
25 |
241 , |
0.000002 |
|
65 |
1 , |
-0.000000 |
26 |
122 , |
0.000000 |
|
66 |
17 , |
0.000001 |
27 |
-36 , |
-0.000000 |
|
67 |
-23 , |
-0.000001 |
28 |
-115 , |
-0.000001 |
|
68 |
-210 , |
-0.000005 |
29 |
-91 , |
-0.000001 |
|
69 |
-446 , |
-0.000009 |
30 |
-29 , |
-0.000000 |
|
70 |
-399 , |
-0.000007 |
31 |
4 , |
-0.000000 |
|
71 |
203 , |
0.000003 |
32 |
3 , |
0.000000 |
|
72 |
1174 , |
0.000013 |
33 |
0 , |
-0.000000 |
|
73 |
1785 , |
0.000014 |
34 |
5 , |
0.000000 |
|
74 |
1247 , |
0.000006 |
35 |
-7 , |
-0.000000 |
|
75 |
-522 , |
-0.000001 |
36 |
-51 , |
-0.000000 |
|
76 |
-2556 , |
0.000004 |
37 |
-91 , |
-0.000000 |
|
77 |
-3367 , |
0.000015 |
38 |
-68 , |
-0.000000 |
|
78 |
-2071 , |
0.000016 |
39 |
28 , |
-0.000000 |
|
79 |
769 , |
-0.000008 |
40 |
133 , |
-0.000001 |
|
80 |
3382 ; |
0.000110 |
Задание №4. Синтез фильтра.
Текст программы:
.module/ram/abs=0 qq;
.var/dm/circ signal[80];
.init signal: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;
.var/pm/circ imp[80];
.init imp:
.include <$FUR_RE.dat>;
i4=^imp;
l4=%imp;
m4=1;
m5=0;
i0=^signal;
l0=%signal;
m0=0;
m1=1;
cntr=80;
do count until ce;
ay0=pm(i4,m5);
si=px;
sr=lshift si by 8 (lo);
sr=lshift sr0 by -8 (lo);
si=ay0;
sr=sr or lshift si by 8 (lo);
ay0=sr0;
count: pm(i4,m4)=ay0;
do vivod until forever;
mx0=io(0);
dm(i0,m1)=mx0,mr=0;
my0=pm(i4,m4);
cntr=78;
do filtr until ce;
filtr: mr=mr+mx0*my0(ss), mx0=dm(i0,m1),my0=pm(i4,m4);
mr=mr+mx0*my0(ss),mx0=dm(i0,m0),my0=pm(i4,m4);
mr=mr+mx0*my0(ss);
if mv sat mr;
mr=mr(rnd);
vivod: io(1)=mr1;
.endmod;
Результаты после подачи на вход eдиничного скачка 0x7FFF, после чего на выходе получаем ИХ:
4014 2232 -751 -2984 -3197 -1599 479 1689 1581 678 -171 -481 -339 -98 12 9 1 13 -14 -103 -174 -122 48 212 241 122 -36 -115 -91 -29 4 3 0 5 -7 -51 -91 -68 28 133 160 85 -27 -90 -75 -26 3 3 0 6 -7 -60 -113 -89 39 195 248 141 -46 -166 -148 -54 8 7 1 17 -23 -210 -446 -399 203 1174 1785 1247 -522 -2556 -3367 -2071 769 3382 |
4014 , 2232 , -751 , -2984 , -3197 , -1599 , 479 , 1689 , 1581 , 678 , -171 , -481 , -339 , -98 , 12 , 9 , 1 , 13 , -14 , -103 , -174 , -122 , 48 , 212 , 241 , 122 , -36 , -115 , -91 , -29 , 4 , 3 , 0 , 5 , -7 , -51 , -91 , -68 , 28 , 133 , 160 , 85 , -27 , -90 , -75 , -26 , 3 , 3 , 0 , 6 , -7 , -60 , -113 , -89 , 39 , 195 , 248 , 141 , -46 , -166 , -148 , -54 , 8 , 7 , 1 , 17 , -23 , -210 , -446 , -399 , 203 , 1174 , 1785 , 1247 , -522 , -2556 , -3367 , -2071 , 769 , 3382 ; |
Теперь подадим на вход две синусоиды с частотами 400 и 2200 Гц.
В результате получим