-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
91 lines (77 loc) · 2.93 KB
/
main.cpp
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
#include <iostream>
#include <conio.h>
#include "sampling.h"
#include "signalRecovery.h"
int main(int argc, char const *argv[])
{
//sin(x + pi/6);
double F = 0;
std::cout << std::endl << "Input F: ";
std::cin >> F;
//3.1
//3.1.1
std::vector<double> sample1 = sampling(F, 1.5);
std::cout << std::endl << std::endl << "RESULT OF SAMPLING (fd = 1,5F):" << std::endl << std::endl;
int i = 0;
for (std::vector<double>::iterator it = sample1.begin(); it != sample1.end(); ++it)
{
std::cout << "n = " << i << ":u[n] = " << *it << std::endl;
i++;
}
/* std::vector<std::pair<double, double>> recovery1 = signalRecovery(1/(1.5*F), 10/F, sample1);
std::cout << std::endl << std::endl << "RECOVERY:" << std::endl << std::endl;
for (int i = 0; i < recovery1.size(); i++)
{
std::cout << "t=" << recovery1[i].first << "; u(t)=" << recovery1[i].second << " ";
}
std::cout << std::endl << std::endl << "Press Enter to resume..." << std::endl << std::endl;*/
getch();
//3.1.2
std::vector<double> sample2 = sampling(F, 1.75);
std::cout << std::endl << std::endl << "RESULT OF SAMPLING (fd = 1,75F):" << std::endl << std::endl;
i = 0;
for (std::vector<double>::iterator it = sample2.begin(); it != sample2.end(); ++it)
{
std::cout << "n = " << i << ":u[n] = " << *it << std::endl;
i++;
}
std::cout << std::endl << std::endl << "Press Enter to resume..." << std::endl << std::endl;
getch();
//3.1.3
std::vector<double> sample3 = sampling(F, 2);
std::cout << std::endl << std::endl << "RESULT OF SAMPLING (fd = 2F):" << std::endl << std::endl;
i = 0;
for (std::vector<double>::iterator it = sample3.begin(); it != sample3.end(); ++it)
{
std::cout << "n = " << i << ":u[n] = " << *it << std::endl;
i++;
}
std::cout << std::endl << std::endl << "Press Enter to resume..." << std::endl << std::endl;
getch();
//3.1.4
std::vector<double> sample4 = sampling(F, 3);
std::cout << std::endl << std::endl << "RESULT OF SAMPLING (fd = 3F):" << std::endl << std::endl;
i = 0;
for (std::vector<double>::iterator it = sample4.begin(); it != sample4.end(); ++it)
{
std::cout << "n = " << i << ":u[n] = " << *it << std::endl;
i++;
}
std::vector<std::pair<double, double>> recovery4 = signalRecovery(1/(3*F), 10/F, sample4);
std::cout << std::endl << std::endl << "RECOVERY:" << std::endl << std::endl;
for (int i = 0; i < recovery4.size(); i++)
{
std::cout << "t=" << recovery4[i].first << "; u(t)=" << recovery4[i].second << " ";
}
std::cout << std::endl << std::endl << "Press Enter to resume..." << std::endl << std::endl;
getch();
//3.1.5
std::vector<double> sample5 = sampling(F, 1000);
std::cout << std::endl << std::endl << "RESULT OF SAMPLING (fd = 1000F):" << std::endl << std::endl;
i = 0;
for (std::vector<double>::iterator it = sample5.begin(); it != sample5.end(); ++it)
{
std::cout << "n = " << i << ":u[n] = " << *it << std::endl;
i++;
}
}