Android frequency vibration
<p>I am working on an android application which detect the hand shaking (through accelerometer) and it modulates the vibration frequency based on shaking intensity.</p>

<p>I am able to get the tremor intensity through standard deviation (code below):</p>

<pre><code>public void regressionCalc() {
    //Calculating sum values
    double sumZ;
    double meanZ;
    sumZ = 0;

    final TextView accZText = (TextView) findViewById(R.id.accelText);
    accZText.setText("");

    for (int r = 0; r &lt; recArray.length; r++) {
        sumZ = sumZ + recArray[r];
    }
    meanZ = sumZ/recArray.length;

    //Calculating standard deviation
    double sumXu2; //this represents E((x-xbar)^2)
    sumXu2 = 0;
    for (int x = 0; x &lt; recArray.length; x++) {
        sumXu2 += ((recArray[x]-meanZ)*(recArray[x]-meanZ));
    }
    double SD;
    SD = Math.sqrt(sumXu2/(recArray.length-1));
    tremorIntensity = SD;

    accZText.setText(String.format("%.2f", tremorIntensity) + "");
    accZText.setTextSize(80);
}
</code></pre>

<p>but I don't know how to work with vibration. I mean, I would like the phone vibration intensity decrease or increase based on the regression value.</p>

<p>Could anyone address me to a correct way?
Thanks in advance.</p>