-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
37 lines (30 loc) · 784 Bytes
/
Copy pathtest.cpp
File metadata and controls
37 lines (30 loc) · 784 Bytes
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
#include <iostream>
#include <iomanip>
int main()
{
std::cout<<"Hello World\n";
float signal[10] = {0.3, 1.1, 0.6, -0.6, -0.8, -0.0, 0.8, 0.7, -0.7, -1.0};
float desired[10] = {0.0, 1.0, 0.6, -0.6, -1.0, -0.0, 1.0, 0.6, -0.6, -1.0};
float h[3] = {0.0, 0.0, 0.0};
float r[3] = {0.0, 0.0, 0.0};
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 10 - i; j++)
{
h[i] += (signal[j] * signal[j + i]);
r[i] += (signal[j] * desired[j + i]);
}
}
for (int i = 0; i < 3; i++)
{
std::cout << h[i] << " ";
}
std::cout << "\n";
for (int i = 0; i < 3; i++)
{
std::cout << r[i] << " ";
}
// 5.28 1.88 -2.86
// 5.26 1.96 -3.06
return 0;
}