Skip to content

Commit

Permalink
Merge pull request #30 from akkoyun/02.00.02
Browse files Browse the repository at this point in the history
02.00.02
  • Loading branch information
akkoyun authored Apr 4, 2022
2 parents e10b45e + 5765b74 commit 7c5b35c
Show file tree
Hide file tree
Showing 12 changed files with 955 additions and 767 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/akkoyun/Statistical) ![arduino-library-badge](https://www.ardu-badge.com/badge/Statistical.svg?) ![Visits Badge](https://badges.pufler.dev/visits/akkoyun/Statistical) ![GitHub stars](https://img.shields.io/github/stars/akkoyun/Statistical?style=flat&logo=github) ![Updated Badge](https://badges.pufler.dev/updated/akkoyun/Statistical) ![PlatformIO Registry](https://badges.registry.platformio.org/packages/akkoyun/library/Statistical.svg)
[![Check Arduino](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml) [![Compile Examples](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml) [![Spell Check](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml)

Build - 01.04.15
Build - 02.00.02

---

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/akkoyun/Statistical) ![arduino-library-badge](https://www.ardu-badge.com/badge/Statistical.svg?) ![Visits Badge](https://badges.pufler.dev/visits/akkoyun/Statistical) ![GitHub stars](https://img.shields.io/github/stars/akkoyun/Statistical?style=flat&logo=github) ![Updated Badge](https://badges.pufler.dev/updated/akkoyun/Statistical) ![PlatformIO Registry](https://badges.registry.platformio.org/packages/akkoyun/library/Statistical.svg)
[![Check Arduino](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml) [![Compile Examples](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml) [![Spell Check](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml)

Build - 01.04.15
Build - 02.00.01

---

Expand Down
Binary file modified examples/.DS_Store
Binary file not shown.
58 changes: 33 additions & 25 deletions examples/Array/Array.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,47 @@ void setup() {
// Start Serial
Serial.begin(115200);

// Set Data
Serial.println(F("Learning Data..."));

}

void loop() {

// Set Data
Serial.println("Learning Data...");
float Data_Array[] = {220.14, 221.36, 218.21, 217.6, 215.7, 225.8, 220.14 };
uint8_t Data_Size = 7;
// float Data[] = {220.14, 221.36, 218.21, 217.6, 215.7, 225.8, 220.14};
// double Data[] = {220.14, 221.36, 218.21, 217.6, 215.7, 225.8, 220.14};
uint8_t Data[] = {14, 36, 21, 6, 7, 14};

// Print Array
Serial.print("Data Array : ");
for (uint8_t i = 0; i < Data_Size; i++) {Serial.print("["); Serial.print(Data_Array[i]); Serial.print("] ");} Serial.println("");
// Construct Object
Array_Stats<uint8_t> Data_Array(Data, sizeof(Data) / sizeof(Data[0]));

// Print Stats
Serial.print("Array Sum : "); Serial.println(Stats.Array_Sum(Data_Array, Data_Size));
Serial.print("Array Square Sum : "); Serial.println(Stats.Array_Sq_Sum(Data_Array, Data_Size));
Serial.print("Array Min : "); Serial.println(Stats.Array_Min(Data_Array, Data_Size));
Serial.print("Array Max : "); Serial.println(Stats.Array_Max(Data_Array, Data_Size));
Serial.print("Array Arithmetic Average : "); Serial.println(Stats.Array_Arithmetic_Average(Data_Array, Data_Size));
Serial.print("Array Geometric Average : "); Serial.println(Stats.Array_Geometric_Average(Data_Array, Data_Size));
Serial.print("Array RMS Average : "); Serial.println(Stats.Array_RMS_Average(Data_Array, Data_Size));
Serial.print("Array Extended RMS Average : "); Serial.println(Stats.Array_Ext_RMS_Average(Data_Array, Data_Size));
Serial.print("Array Median : "); Serial.println(Stats.Array_Median(Data_Array, Data_Size));
Serial.print("Array Standard Deviation : "); Serial.println(Stats.Array_Standard_Deviation(Data_Array, Data_Size));
Serial.print("Array Standard Deviation Error : "); Serial.println(Stats.Array_Standard_Deviation_Error(Data_Array, Data_Size));
Serial.print("Array Coefficient Factor : "); Serial.println(Stats.Array_Coefficient_Factor(Data_Array, Data_Size));

Serial.print("Sorted Data Array : ");
for (uint8_t i = 0; i < Data_Size; i++) {Serial.print("["); Serial.print(Data_Array[i]); Serial.print("] ");} Serial.println("");

Serial.println("--------------------------------------------------");

delay(2000);
Serial.println(F("------------------------------------------------"));
Serial.print(F("Data Array : ")); Data_Array.Array();
Serial.println(F("------------------------------------------------"));
Serial.print(F("Array Size : ")); Serial.println(Data_Array.Size());
Serial.print(F("Array Sum : ")); Serial.println(Data_Array.Sum());
Serial.print(F("Array Min : ")); Serial.println(Data_Array.Min());
Serial.print(F("Array Max : ")); Serial.println(Data_Array.Max());
Serial.print(F("Array Square Sum : ")); Serial.println(Data_Array.Sq_Sum());
Serial.print(F("Array Arithmetic Average : ")); Serial.println(Data_Array.Average(Data_Array.Arithmetic_Avg));
Serial.print(F("Array Geometric Average : ")); Serial.println(Data_Array.Average(Data_Array.Geometric_Avg));
Serial.print(F("Array RMS Average : ")); Serial.println(Data_Array.Average(Data_Array.RMS_Avg));
Serial.print(F("Array Extended RMS Average : ")); Serial.println(Data_Array.Average(Data_Array.Ext_RMS_Avg));
Serial.print(F("Array Q1 : ")); Serial.println(Data_Array.Quartile(1));
Serial.print(F("Array Q2 (Median) : ")); Serial.println(Data_Array.Quartile(2));
Serial.print(F("Array Q3 : ")); Serial.println(Data_Array.Quartile(3));
Serial.print(F("Array IQR : ")); Serial.println(Data_Array.IQR());
Serial.print(F("Array Standard Deviation : ")); Serial.println(Data_Array.Standard_Deviation());
Serial.print(F("Array Standard Deviation Error : ")); Serial.println(Data_Array.Standard_Deviation_Error());
Serial.print(F("Array Coefficient Factor : ")); Serial.println(Data_Array.Coefficient_Factor());
Serial.print(F("Array Variance : ")); Serial.println(Data_Array.Variance());
Serial.println(F("------------------------------------------------"));
Serial.print(F("Sorted Data Array : ")); Data_Array.Array();

// Loop Delay
delay(5000);

}

62 changes: 62 additions & 0 deletions examples/FILO_Array/FILO_Array.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Include Statistal Library
#include <Statistical.h>


// Set Data
float Data[5];

// Construct Object
Array_Stats<float> Data_Array(Data, sizeof(Data) / sizeof(Data[0]));


void setup() {

// Start Serial
Serial.begin(115200);

// Set Data
Serial.println(F("Learning Data..."));

// Set FILO
Data_Array.Set_FILO_Size(4);

// Add Data to FILO Array
Data_Array.FILO_Add_Data(220.12);
Data_Array.FILO_Add_Data(214.35);
Data_Array.FILO_Add_Data(200.14);
Data_Array.FILO_Add_Data(212.80);
Data_Array.FILO_Add_Data(242.33);
Data_Array.FILO_Add_Data(215.99);
Data_Array.FILO_Add_Data(220.12);

// Print Stats
Serial.println(F("------------------------------------------------"));
Serial.print(F("Array Size : ")); Serial.println(Data_Array.Size());
Serial.println(F("------------------------------------------------"));
Serial.print(F("Data Array : ")); Data_Array.Array();
Serial.print(F("Array Sum : ")); Serial.println(Data_Array.Sum());
Serial.print(F("Array Min : ")); Serial.println(Data_Array.Min());
Serial.print(F("Array Max : ")); Serial.println(Data_Array.Max());
Serial.print(F("Array Square Sum : ")); Serial.println(Data_Array.Sq_Sum());
Serial.print(F("Array Arithmetic Average : ")); Serial.println(Data_Array.Average(Data_Array.Arithmetic_Avg));
Serial.print(F("Array Geometric Average : ")); Serial.println(Data_Array.Average(Data_Array.Geometric_Avg));
Serial.print(F("Array RMS Average : ")); Serial.println(Data_Array.Average(Data_Array.RMS_Avg));
Serial.print(F("Array Extended RMS Average : ")); Serial.println(Data_Array.Average(Data_Array.Ext_RMS_Avg));
Serial.print(F("Array Q1 : ")); Serial.println(Data_Array.Quartile(1));
Serial.print(F("Array Q2 (Median) : ")); Serial.println(Data_Array.Quartile(2));
Serial.print(F("Array Q3 : ")); Serial.println(Data_Array.Quartile(3));
Serial.print(F("Array IQR : ")); Serial.println(Data_Array.IQR());
Serial.print(F("Array Standard Deviation : ")); Serial.println(Data_Array.Standard_Deviation());
Serial.print(F("Array Standard Deviation Error : ")); Serial.println(Data_Array.Standard_Deviation_Error());
Serial.print(F("Array Coefficient Factor : ")); Serial.println(Data_Array.Coefficient_Factor());
Serial.print(F("Array Variance : ")); Serial.println(Data_Array.Variance());
Serial.println(F("------------------------------------------------"));
Serial.print(F("Sorted Data Array : ")); Data_Array.Array();

}

void loop() {


}

71 changes: 33 additions & 38 deletions examples/Linear_Regression/Linear_Regression.ino
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
#include <Statistical.h>

Statistical DataSet;

void setup() {

// Start Serial
Serial.begin(115200);


// Set Data
Serial.println("Learning Data...");

}

void loop() {

// Set Data
Serial.println("Learning Data...");
uint8_t Data_X[] = {1, 2, 3, 4, 5, 6, 7};
float Data_Y[] = {2, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7};

// Declare Object
Linear_Regression<uint8_t, float> Regression(Data_X, Data_Y, sizeof(Data_X) / sizeof(Data_X[0]));

// Print Array X
Serial.print("Data X Array : ");
for (size_t i = 0; i < sizeof(Data_X) / sizeof(Data_X[0]); i++) {Serial.print(F("[")); Serial.print(Data_X[i]); Serial.print(F("] "));}
Serial.println("");

// Print Array X
Serial.print("Data Y Array : ");
for (size_t i = 0; i < sizeof(Data_X) / sizeof(Data_X[0]); i++) {Serial.print(F("[")); Serial.print(Data_Y[i]); Serial.print(F("] "));}
Serial.println("");

// Print Regression Slope
Serial.print("Slope : "); Serial.println(Regression.Slope(),5);

// Print Regression Offset
Serial.print("Offset : "); Serial.println(Regression.Offset(),5);

// Print Regression R2
Serial.print("R2 : "); Serial.println(Regression.R2(),5);

// Print Divider
Serial.println("--------------------------");

// Set Precision
uint8_t Linear_Regression_Precision = 5;

// Set Array
float Data[Linear_Regression_Precision][2];

// Learn Data
DataSet.Array_FILO(Data, Linear_Regression_Precision, 1, 220.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 2, 221.36);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 3, 218.21);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 4, 217.06);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 5, 220.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 6, 222.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 7, 225.14);

// Print FILO Array
Serial.print("Regression Data Array : ");
for (uint8_t i = 0; i < Linear_Regression_Precision; i++) {
Serial.print("[");
Serial.print(Data[i][0]);
Serial.print(",");
Serial.print(Data[i][1]);
Serial.print("] ");
}
Serial.println("");

// Print Calculated Data
Serial.print("Regression Data Count : "); Serial.println(Linear_Regression_Precision);
Serial.print("Regression Slope : "); Serial.println(DataSet.Linear_Regression_Slope(Data, Linear_Regression_Precision), 4);
Serial.print("Regression Offset : "); Serial.println(DataSet.Linear_Regression_Offset(Data, Linear_Regression_Precision), 4);
Serial.print("Regression R2 : "); Serial.println(DataSet.Linear_Regression_R2(Data, Linear_Regression_Precision), 4);
Serial.println("------------------------");

delay(10000);
// Delay
delay(1000);

}

29 changes: 16 additions & 13 deletions examples/Stream/Stream.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <Statistical.h>

Statistical DataSet;

void setup() {

// Start Serial
Expand All @@ -11,23 +9,28 @@ void setup() {

void loop() {

// Set Data
// Construct Object
Stream_Stats<float> _Stream;

// Learn Print
Serial.println("Learning Data...");
DataSet.Stream_Statistic(125.2);
DataSet.Stream_Statistic(122.2);
DataSet.Stream_Statistic(121.2);
DataSet.Stream_Statistic(128.2);
DataSet.Stream_Statistic(132.2);

// Set Data
_Stream.Add(125.2);
_Stream.Add(122.2);
_Stream.Add(121.2);
_Stream.Add(128.2);
_Stream.Add(132.2);

// Print Calculations
Serial.print("Stream Data Count : "); Serial.println(DataSet.Stream_Data_Count);
Serial.print("Stream Avg Value : "); Serial.println(DataSet.Stream_Average);
Serial.print("Stream Min Value : "); Serial.println(DataSet.Stream_Minimum);
Serial.print("Stream Max Value : "); Serial.println(DataSet.Stream_Maximum);
Serial.print("Stream Data Count : "); Serial.println(_Stream.Get_Data_Count());
Serial.print("Stream Avg Value : "); Serial.println(_Stream.Get_Average());
Serial.print("Stream Min Value : "); Serial.println(_Stream.Get_Min());
Serial.print("Stream Max Value : "); Serial.println(_Stream.Get_Max());
Serial.println("----------------");

// Reset
DataSet.Stream_Data_Clear();
_Stream.Clear();

delay(1000);

Expand Down
9 changes: 8 additions & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Statistical",
"version": "1.4.15",
"version": "2.0.2",
"keywords": "Statistical, Max, Min, Average, Regression, Data, Sensor, Slope, Offset",
"description": "Function calculates statistical parameters of data stream and array",
"authors":
Expand Down Expand Up @@ -30,6 +30,13 @@
"Array.ino"
]
},
{
"name": "FILO_Array",
"base": "examples/FILO_Array/",
"files": [
"FILO_Array.ino"
]
},
{
"name": "Linear Regression",
"base": "examples/Linear_Regression/",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Statistical
version=1.4.15
version=2.0.2
author=Gunce Akkoyun <[email protected]>
maintainer=Gunce Akkoyun <[email protected]>
sentence=Statistic, Sum, Max, Min, Sq_Sum, Arithmetic Average, Geometric Average, RMS Average, Ext RMS Average, Bubble Sort, Median, Standard Deviation, Standard Deviation Error, Coefficient Factor, Average, Stream, Regression, Slope, Data, Analyse
Expand Down
Loading

0 comments on commit 7c5b35c

Please sign in to comment.