-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbb30.cpp
More file actions
28 lines (22 loc) · 706 Bytes
/
bb30.cpp
File metadata and controls
28 lines (22 loc) · 706 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
/* Data Converter for Rig Expert AA-30.ZERO */
/* % g++ bb30.cpp -o bb30 */
#include <complex>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
double freq, r, x;
double absz, retloss, vswr;
complex<double> z, rho;
const complex<double> z0 = 50.0;
while (cin >> freq >> r >> x) {
if(r<0) r=0.01;
z = complex<double>(r,x);
absz = abs(z);
rho = (z-z0)/(z+z0);
retloss = -20.0 * log( abs(rho) ) / log( 10.0 );
vswr = ( 1+abs(rho) ) / ( 1-abs(rho) );
cout << freq << " " << r << " " << x << " " << absz << " "
<< retloss << " " << vswr << " "
<< arg(rho) << " " << abs(rho) << endl;
}
}