added an html outputfile so you can see the graphs in your browser

This commit is contained in:
gurkenhabicht 2018-05-04 21:10:31 +02:00
parent 6072f3459c
commit 6b9bd76cdd
3 changed files with 36 additions and 10 deletions

View File

@ -13,7 +13,7 @@
#include <string.h>
#include <float.h> // DBL_MAX
#define M 100
#define M 1000
#define tracking 40 //Count of weights
#define learnrate 1.0
#define PURE_WEIGHTS 0
@ -39,7 +39,9 @@ point_t points[M]; // [0]=xActual, [1]=xPredicted from directPredecessor, [2]=xP
char * mkFileName( char* buffer, size_t max_len, int suffixId );
char *fileSuffix( int id );
void myLogger( FILE* fp, point_t points[]);
size_t getline( char **lineptr, size_t *n, FILE *stream ); //redundant under POSIX supporting OS
#ifdef _WIN32
size_t getline( char **lineptr, size_t *n, FILE *stream );
#endif
void mkSvgGraph( point_t points[]);
/* *rand seed* */
@ -307,15 +309,15 @@ void Graph ( ) {
void myLogger ( FILE* fp, point_t points[] ){
int i;
for( i = 0; i <= M; i++ ){
for( i = 0; i <= M; i++ ){ // xActual
fprintf( fp, "L %f %f\n", points[i].xVal[0], points[i].yVal[0]);
}
fprintf(fp, "\" fill=\"none\" stroke=\"blue\" stroke-width=\"0.8px\"/>\n<path d=\"M0 0\n");
for( i = 0; i < M-1; i++ ) {
fprintf(fp, "\" fill=\"none\" stroke=\"blue\" stroke-width=\"0.4px\"/>\n<path d=\"M0 0\n");
for( i = 0; i < M-1; i++ ) { // xPred from directPredecessor
fprintf( fp, "L %f %f\n", points[i].xVal[1], points[i].yVal[1]);
}
fprintf(fp, "\" fill=\"none\" stroke=\"green\" stroke-width=\"0.8px\"/>\n<path d=\"M0 0\n");
for( i = 0; i <= M; i++ ) {
fprintf(fp, "\" fill=\"none\" stroke=\"green\" stroke-width=\"0.4px\"/>\n<path d=\"M0 0\n");
for( i = 0; i <= M; i++ ) { //xPred from lastMean
fprintf(fp, "L %f %f\n", points[i].xVal[2], points[i].yVal[2]);
}
}
@ -388,7 +390,7 @@ double rndm( void ) {
=========================================================================
*/
#ifdef _WIN32
size_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL;
char *p = bufptr;
@ -440,7 +442,7 @@ size_t getline(char **lineptr, size_t *n, FILE *stream) {
return p - bufptr - 1;
}
#endif
/*

24
bin/graphResults.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
NLMSvariants | Graphical Output ||
<font color="blue">Eingangswert</font> |
<font color="red">direkter Vorgaenger</font> |
<font color="green">letzter Mittelwert</font>
</head>
<body>
<object data="output.svg" type="image/svg+xml"> </object>
<table width = "100%" border = 1>
<tr align = "top">
<td colspan = "2" bgcolor = "#fefefe">
<h1>
<font color="blue">Eingangswert</font> |
<font color="red">direkter Vorgaenger</font> |
<font color="green">letzter Mittelwert</font>
</h1>
</td>
</tr>
</body>
<html>

View File

@ -22,7 +22,7 @@
</g>
<g transform="translate(200, 400) scale(1,-1)">
<path d="M0 0
" fill="none" stroke="red" stroke-width="0.8px"/>
" fill="none" stroke="red" stroke-width="0.4px"/>
<text class="t36 t-mid bold f-black" x="50" y="50">+ +</text>
<text class="t36 t-mid bold f-black" x="-50" y="50">- +</text>
<text class="t36 t-mid bold f-black" x="50" y="-50">+ -</text>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB