Browse Source

Least squares fit fixed.

Neal Wilson 11 years ago
parent
commit
8482ad1353
1 changed files with 4 additions and 9 deletions
  1. 4
    9
      qml/BrewPlot/main.qml

+ 4
- 9
qml/BrewPlot/main.qml View File

10
     property real sumxy : 0
10
     property real sumxy : 0
11
     property int n : 0
11
     property int n : 0
12
 
12
 
13
-    width: 720
14
-    height: 680
13
+    width: 720; height: 680
15
 
14
 
16
     BrewingControlChart {
15
     BrewingControlChart {
17
         id: graph
16
         id: graph
27
 
26
 
28
             ListView {
27
             ListView {
29
                 spacing: 3
28
                 spacing: 3
30
-                height: 400
31
-                width: 100
32
-                z: -1
29
+                height: 600; width: 100
33
                 contentHeight: dataViewModel.count * 35
30
                 contentHeight: dataViewModel.count * 35
34
 
31
 
35
                 model: ListModel {
32
                 model: ListModel {
55
         }
52
         }
56
     }
53
     }
57
 
54
 
58
-
59
     Component.onCompleted: {
55
     Component.onCompleted: {
60
         var quitItem = window.addMenuItem("File", "Quit");
56
         var quitItem = window.addMenuItem("File", "Quit");
61
         quitItem.shortcut = "Ctrl+Q";
57
         quitItem.shortcut = "Ctrl+Q";
77
         showLeastSquares.checkable = true;
73
         showLeastSquares.checkable = true;
78
         showLeastSquares.triggered.connect(function() {
74
         showLeastSquares.triggered.connect(function() {
79
             graph.setFitVisible(showLeastSquares.checked);
75
             graph.setFitVisible(showLeastSquares.checked);
80
-            lsfrow.visible = showLeastSquares.checked;
81
         });
76
         });
82
         window.newPoint.connect(function(pointDescription) {
77
         window.newPoint.connect(function(pointDescription) {
83
             graph.plotPoint(pointDescription.extraction,
78
             graph.plotPoint(pointDescription.extraction,
87
             root.n += 1
82
             root.n += 1
88
             root.sumy += pointDescription.ptds / 100
83
             root.sumy += pointDescription.ptds / 100
89
             root.sumx += pointDescription.extraction
84
             root.sumx += pointDescription.extraction
90
-            root.sumxy += ((pointDescription.ptds / 100) * extraction)
91
-            root.sumxsq += Math.pow(extraction, 2)
85
+            root.sumxy += ((pointDescription.ptds / 100) * pointDescription.extraction)
86
+            root.sumxsq += Math.pow(pointDescription.extraction, 2)
92
             if(root.n > 1) {
87
             if(root.n > 1) {
93
                 var a = ((root.sumy * root.sumxsq)-(root.sumx * root.sumxy))/((root.n * root.sumxsq)-Math.pow(root.sumx, 2))
88
                 var a = ((root.sumy * root.sumxsq)-(root.sumx * root.sumxy))/((root.n * root.sumxsq)-Math.pow(root.sumx, 2))
94
                 var b = ((root.n * root.sumxy)-(root.sumx * root.sumy))/((root.n * root.sumxsq) - Math.pow(root.sumx, 2))
89
                 var b = ((root.n * root.sumxy)-(root.sumx * root.sumy))/((root.n * root.sumxsq) - Math.pow(root.sumx, 2))

Loading…
Cancel
Save