Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. private void CalcError()
  2. {
  3. for (int i = 0; i < cl1.n; i++)
  4. {
  5. if (NormDistr(cl1.mas1[i], cl1.mas2[i], cl1) * cl1.P < NormDistr(cl1.mas1[i], cl1.mas2[i], cl2) * cl2.P)
  6. cl1.cntPo++;
  7. }
  8.  
  9. for (int i = 0; i < cl2.n; i++)
  10. {
  11. if (NormDistr(cl2.mas1[i], cl2.mas2[i], cl2) * cl2.P < NormDistr(cl2.mas1[i], cl2.mas2[i], cl1) * cl1.P)
  12. cl2.cntPo++;
  13. }
  14. }
  15.  
  16. private double NormDistr(double X, double Y, Class cl)
  17. {
  18. // степень нормального распределения
  19. double ePow = (-1.0 / 2.0) * (Math.Pow(X - cl.om1, 2) / cl.od1 + Math.Pow(Y - cl.om2, 2) / cl.od2);
  20.  
  21. // нормальное распределение
  22. return (1.0/Math.PI*Math.Sqrt(cl.od1)*Math.Sqrt(cl.od2))*Math.Pow(Math.E, ePow);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement