Results 1 to 2 of 2
Thread: standard deviation in java
- 03-17-2012, 04:29 PM #1
standard deviation in java
hi
standard deviation formula is
I've x-values in yArray[]
and the code shows errors
and ive almost broken my head
i would get relaxed for a second, if u tell me the error in the codeJava Code:double avgT=0; double avgT2=0; double[] SD =new double[TotalLineCount/4];//totallinecount is the number of lines in my input text file for(int j=0;j<TotalLineCount;j=j+4) { for(int k=j+0;k<j+4;k++) //for every 4 values, Standard Deviation is found { System.out.println(avgT); avgT=ReadPlatInstance.yArray[k]+avgT; //this is E(X^2) System.out.println(avgT); avgT2=(ReadPlatInstance.yArray[k]*ReadPlatInstance.yArray[k])+avgT2; //this is E(X) System.out.println("\t k is "+k); } SD[j]=Math.sqrt(((avgT2/4)-((avgT/4)*(avgT/4)))/((4)*(4-1))); //this part shows wrong answer. i've checked with "stdev" function in excel.
thanks
dhilipLast edited by noobplus; 03-17-2012 at 05:25 PM.
- 03-17-2012, 05:22 PM #2
Similar Threads
-
Computing standard deviation using public static classes to call from another class
By exeye0h in forum New To JavaReplies: 15Last Post: 02-13-2012, 09:00 PM -
standard deviation error
By rochla16 in forum New To JavaReplies: 2Last Post: 05-03-2011, 04:43 AM -
standard deviation calculation
By rochla16 in forum New To JavaReplies: 5Last Post: 04-28-2011, 07:27 PM -
[SOLVED] Calculating Std. Deviation using Java
By random0munky in forum New To JavaReplies: 1Last Post: 12-12-2008, 09:24 AM -
standard deviation and mean for an array
By peterdfl in forum New To JavaReplies: 3Last Post: 05-29-2008, 04:09 AM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks