wart.norm=(wartosc wyjsciowa-minimum)/(maximum-minimum)
Mam dwie tabele:
1. dane wyjsciowe:
Kod
+----+------------+-----------+----------+----------+--------+---------+----------+----------+----------+
| ID | DN | CSr | OS | CS | CL | CH | futureSH | futureSL | futureCS |
+----+------------+-----------+----------+----------+--------+---------+----------+----------+----------+
| 1 | 2005-01-03 | 0 | 0.00975 | -0.00495 | 0.0064 | -0.0163 | -0.00065 | -0.03135 | -0.02645 |
| 2 | 2005-01-04 | 0.124716 | 0.01115 | -0.01045 | 0.0049 | -0.0258 | -0.00315 | -0.02045 | -0.01055 |
| 3 | 2005-01-05 | 0.0933306 | 0.00095 | 0.00125 | 0.0099 | -0.0074 | 0.00445 | -0.01205 | -0.00615 |
| 4 | 2005-01-06 | 0.0590543 | 0.00525 | -0.00235 | 0.0059 | -0.0106 | 0.00895 | -0.01315 | -0.00895 |
................................................................................
.........................
| ID | DN | CSr | OS | CS | CL | CH | futureSH | futureSL | futureCS |
+----+------------+-----------+----------+----------+--------+---------+----------+----------+----------+
| 1 | 2005-01-03 | 0 | 0.00975 | -0.00495 | 0.0064 | -0.0163 | -0.00065 | -0.03135 | -0.02645 |
| 2 | 2005-01-04 | 0.124716 | 0.01115 | -0.01045 | 0.0049 | -0.0258 | -0.00315 | -0.02045 | -0.01055 |
| 3 | 2005-01-05 | 0.0933306 | 0.00095 | 0.00125 | 0.0099 | -0.0074 | 0.00445 | -0.01205 | -0.00615 |
| 4 | 2005-01-06 | 0.0590543 | 0.00525 | -0.00235 | 0.0059 | -0.0106 | 0.00895 | -0.01315 | -0.00895 |
................................................................................
.........................
2. pobrane z tej tabeli wartosci minimalna i maxymalna dla kazdej kolumny, zapisane w nowej tabeli 'extrema':
Kod
+----------+---------+---------+-------+----------+--------+--------+---------+---------+
| minCSr | maxOS | minOS | maxCS | minCS | maxCL | minCL | maxCH | minCH | itd...............
+----------+---------+---------+-------+----------+--------+--------+---------+---------+
| -0.02744 | 0.01115 | -0.0103 | 0.009 | -0.01045 | 0.0213 | 0.0012 | -0.0007 | -0.0258 |
+----------+---------+---------+-------+----------+--------+--------+---------+---------+
| minCSr | maxOS | minOS | maxCS | minCS | maxCL | minCL | maxCH | minCH | itd...............
+----------+---------+---------+-------+----------+--------+--------+---------+---------+
| -0.02744 | 0.01115 | -0.0103 | 0.009 | -0.01045 | 0.0213 | 0.0012 | -0.0007 | -0.0258 |
+----------+---------+---------+-------+----------+--------+--------+---------+---------+
Probuje to zrealizowac wg nastepujacego kodu:
<?php $Index=2; for ($colIndex=0;$colIndex<mysql_num_fields($selExtremes);$colIndex+2) { $max=$obtExtremes[$colIndex]; $min=$obtExtremes[$colIndex+1]; { $normFunction=(($colrowValue[$Index]-$min)/($max-$min)); } $Index++; } ?>
Nikt się nie pokwapił więc ja poprawiam
---
nospor, Bakus - code