/** Multiplies this sample by the multiplier sample */ public void multiply(ComplexSample multiplier) { float inphase = (inphase() * multiplier.inphase()) - (quadrature() * multiplier.quadrature()); float quadrature = (quadrature() * multiplier.inphase()) + (inphase() * multiplier.quadrature()); mLeft = inphase; mRight = quadrature; }
/** Multiplies both samples returning a new sample with the results */ public static ComplexSample multiply(ComplexSample sample1, ComplexSample sample2) { float inphase = (sample1.inphase() * sample2.inphase()) - (sample1.quadrature() * sample2.quadrature()); float quadrature = (sample1.quadrature() * sample2.inphase()) + (sample1.inphase() * sample2.quadrature()); return new ComplexSample(inphase, quadrature); }
public static void main(String[] args) { double angle = Math.PI; // 180 degrees ComplexSample s1 = new ComplexSample((float) Math.sin(angle), (float) Math.cos(angle)); ComplexSample tap = new ComplexSample(1.0f, -0.1f); ComplexSample convolved = ComplexSample.multiply(s1, tap); mLog.debug( "s: " + s1.toString() + " t: " + tap.toString() + " convolved: " + convolved.toString()); }
public static ComplexSample multiply(ComplexSample sample, Float inphase, Float quadrature) { float i = (sample.inphase() * inphase) - (sample.quadrature() * quadrature); float q = (sample.quadrature() * inphase) + (sample.inphase() * quadrature); return new ComplexSample(i, q); }
public static ComplexSample multiply(ComplexSample sample, float scalor) { return new ComplexSample(sample.left() * scalor, sample.right() * scalor); }
/** Adds the two complex samples returning a new complex sample with the result */ public static ComplexSample subtract(ComplexSample first, ComplexSample second) { return new ComplexSample(first.left() - second.left(), first.right() - second.right()); }
/** Adds the two complex samples returning a new complex sample with the result */ public static ComplexSample add(ComplexSample first, ComplexSample second) { return new ComplexSample(first.left() + second.left(), first.right() + second.right()); }
/** Adds the adder sample value to this sample */ public void add(ComplexSample adder) { mLeft += adder.left(); mRight += adder.right(); }