preciseComplexNCO

正確なComplexNCO

pure nothrow @safe @nogc
preciseComplexNCO
(
real freq
,
real deltaT
,
real theta = 0
)

Examples

auto sig1 = preciseComplexNCO(1000, 0.001, 0);
static assert(isInputStream!(typeof(sig1)));
static assert(isInplaceComputableStream!(typeof(sig1)));
static assert(is(ElementType!(typeof(sig1)) == creal));

assert(equal!((a, b) => approxEqual(a.re, b.re) && approxEqual(a.im, b.im))
            (sig1[0 .. 4], cast(creal[])[1, 1, 1, 1]));

sig1 = preciseComplexNCO(1, 0.25, 0);
assert(equal!((a, b) => approxEqual(a.re, b.re) && approxEqual(a.im, b.im))
            (sig1[0 .. 4], cast(creal[])[1, 0+1i, -1, -1i]));

sig1 = preciseComplexNCO(1000, 10.0L^^-6, std.math.E);
auto buf = sig1[0 .. 1024].array;
assert(sig1.readOp!"-"(buf).length == buf.length);
assert(equal!"a == 0"(buf, buf));

sig1.readOp!"a+b"(buf);

Meta