With the desired magnitude of a transfer function in the frequency domain in C++ as described below what is the correct corresponding minimum phase? In general how does one derive the correct minimum phase in the frequency domain if the desired magnitude is known, specifically such that the a complex IFFT of it would return an entirely real part.
// PnCutoff.cpp : Pink noise above a cutoff.
#include <tchar.h>
#include <math.h>
#include <conio.h>
class PnAtFilter
{
double _fcHz;
public:
PnAtFilter(double fcHz) { _fcHz = fcHz; }
double Mag(double fHz)
{
if(fHz < _fcHz) return 1.0;
else return 1.0 / sqrt(fHz/_fcHz);
}
double Phase(double fHz)
{
return 0.0; // what is the the correct minimum phase in r?
}
};
int _tmain(int argc, _TCHAR* argv[])
{
PnAtFilter* pnf = new PnAtFilter(1000);
for(int fHz = 10; fHz <= 100000; fHz *= 10)
{
double mag = pnf->Mag(fHz);
double phase = pnf->Phase(fHz);
_cprintf_s("%d Mag=%f, Phase=%f\r\n", fHz, mag, phase);
}
_getch();
return 0;
}
/* output:
10 Mag=1.000000, Phase=0.000000
100 Mag=1.000000, Phase=0.000000
1000 Mag=1.000000, Phase=0.000000
10000 Mag=0.316228, Phase=0.000000
100000 Mag=0.100000, Phase=0.000000
*/
```