How to draw an image (of any type, png, jpg, bmp etc) of a Sine wave knowing frequency with amplitude = 1?
amplitude = 1
Example:
One option is to use AndroidPlot. Firstly add it to your dependencies:
AndroidPlot
dependencies { compile "com.androidplot:androidplot-core:1.4.0" }
Add an XYPlot to your layout and then start by amending the following example
XYPlot
More specifically have a look at:
public Number getY(int series, int index) { if (index >= SAMPLE_SIZE) { throw new IllegalArgumentException(); } double angle = (index + (phase))/FREQUENCY; double amp = sinAmp * Math.sin(angle); switch (series) { case SINE1: return amp; case SINE2: return -amp; default: throw new IllegalArgumentException(); } }
And try changing sinAmp to your desired value.
sinAmp
One option is to use
AndroidPlot. Firstly add it to your dependencies:Add an
XYPlotto your layout and then start by amending the following exampleMore specifically have a look at:
And try changing
sinAmpto your desired value.