Android Open Source - APSK Unit Phasor






From Project

Back to project page APSK.

License

The source code is released under:

GNU General Public License

If you think the Android project APSK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * This file is part of znudigi./*w  w w.  j av a  2 s.co m*/
 * Released under GNU GENERAL PUBLIC LICENSE Version 2
 * See file COPYING.
 * Copyright (C) 2007-2008 Leigh L. Klotz, Jr. <Leigh@WA5ZNU.org>
 */

package org.wa5znu.znuradio.dsp;

public class UnitPhasor {
  private int samplerate;
  private double frequency;
  private double delta;
  private double phase;

  public UnitPhasor(int samplerate) {
    this.samplerate = samplerate;
    phase = 0.0;
  }

  public void setFrequency(double f) {
    if(f <= 0.0) {
      return;
    } else if (f == frequency) {
      return;
    } else {
      frequency = f;
      delta = 2.0 * Math.PI * f / samplerate;
      return;
    }
  }

  public double getFrequency() {
    return frequency;
  }

  public double getPhase() {
    double answer = phase;
    phase += delta;
    if (phase > Math.PI) 
      phase -= 2*Math.PI;
    return answer;
  }

  public Complex scale(double d) {
    double phase = getPhase();
    double I = d * Math.cos(phase);
    double Q = d * Math.sin(phase);
    return new Complex(I, Q);
  }

}




Java Source Code List

net.thinkindifferent.apsk.APSK.java
net.thinkindifferent.apsk.AudioInputThread.java
net.thinkindifferent.apsk.Waterfall.java
org.wa5znu.znuradio.dsp.BaseFIRFilter.java
org.wa5znu.znuradio.dsp.Complex.java
org.wa5znu.znuradio.dsp.FFT.java
org.wa5znu.znuradio.dsp.FilterDesign.java
org.wa5znu.znuradio.dsp.IQFIRFilter.java
org.wa5znu.znuradio.dsp.LowPassFilterDesign.java
org.wa5znu.znuradio.dsp.Mixer.java
org.wa5znu.znuradio.dsp.RealFIRFilter.java
org.wa5znu.znuradio.dsp.Subsampler.java
org.wa5znu.znuradio.dsp.UnitPhasor.java
org.wa5znu.znuradio.dsp.Window.java
org.wa5znu.znuradio.modems.bpsk.BPSKDemodulator.java
org.wa5znu.znuradio.modems.bpsk.PSKVaricode.java
org.wa5znu.znuradio.receiver.Controller.java
org.wa5znu.znuradio.receiver.Demodulator.java
org.wa5znu.znuradio.receiver.FrequencyHandler.java
org.wa5znu.znuradio.receiver.ModemThread.java
org.wa5znu.znuradio.receiver.PhaseHandler.java
org.wa5znu.znuradio.receiver.ReceiverHandler.java
org.wa5znu.znuradio.receiver.Receiver.java
org.wa5znu.znuradio.receiver.SpectrumHandler.java
org.wa5znu.znuradio.receiver.SpectrumThread.java
org.wa5znu.znuradio.receiver.StageHandler.java
org.wa5znu.znuradio.receiver.TextHandler.java
org.wa5znu.znuradio.receiver.WaveHandler.java