Code Reg Anal

Code Reg Anal - /* Nick Hookham BIEN 2001 Regression...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Nick Hookham BIEN 2001 Regression Analysis */ #include <stdio.h> //These are required for the program to run #include <string.h> #include <math.h> FILE *fp_in; char fn_in[50]; float calcavg( float in[100], int count); //declare variables defined outside of main float calcstdev( float in[100], float avg, int count); int main() //starts execution { float input_array_x[100]; //declare variables float input_array_y[100]; int i; float averagex; float averagey; float stdevx; float stdevy; int count; float num=0.0; float den=0.0; float slope;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
float regint; float den2; float corco; count = 19; //initializing count strcpy(fn_in, "reg.txt" ); fp_in = fopen(fn_in, "r" ); //open and read file reg for (i=0;i<count;i++) { fscanf(fp_in, "%g %g\n" ,&input_array_x[i],&input_array_y[i]); //read in data points and store in arrays } fclose(fp_in); averagex = calcavg(input_array_x,count); //calculates value for average x *same for next three processes printf( "The average x is %f\n\n" ,averagex); //prints this
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Code Reg Anal - /* Nick Hookham BIEN 2001 Regression...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online