0

Hello,

I'm trying to convert some code from BASIC to C++.. But, I'm stuck on a particular part..

```
REM CREATE A MATRIX C WITH (COS(DN) , -SIN(DN)) :
DIM C(NE, NS, 2)
FOR N = 0 TO NE / 2
FOR E = 0 TO NE - 1
DC = E / FE
FEN = N * FE / NE
DN = 2 * PY * FEN * DC
C(E, N, 1) = COS(DN)
C(E, N, 2) = -SIN(DN)
NEXT E
NEXT N
```

Basically, I don't get the:

```
DIM C(NE, NS, 2)
```

Is this a vector with the size of NE, NS (Which is inputted)?

I also don't get this part:

```
C(E, N, 1) = COS(DN)
C(E, N, 2) = -SIN(DN)
```

Since if C was a vector, I wouldn't be able to push back to different data sets into the same vector.. I don't get the 1/2 differenciation. Also, if cos and sin are in C++, is there a -sin() in the math library?

Here is my code so far:

```
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
const double PY = 3.14159265;
double FE = 0;
double NE = 0;
cout << "Sampling rate" << endl;
cin >> FE;
cout << "Amount of Measures" << endl;
cin >> NE;
double NS = NE / 2 + 1; // Amount of Sunusoids
vector<double> C (FE*NE);
for(int n=0; (n < NE/2); n++)
{
for(int e=0; (e < NE-1); e++)
{
double DC = e / FE;
double FEN = n*FE/NE;
double DN = 2*PY*FEN*DC;
//C.push_back(cos(DN));
}
}
}
```

Hoping someone can help me :)