Question: Develop a C-code I NEED to obtain a linear regression y=ax+b and show the r^2 values. MY CODE SO FAR: #include #include float func(float x,float
Develop a C-code I NEED to obtain a linear regression y=ax+b and show the r^2 values.
MY CODE SO FAR:
#include #include float func(float x,float y); float euler(float x0,float xn,float y0,int n); double sum(double x[],double y[], int n); double r(double x[],double y[], int n, double a, double b); int main() { printf("Calculate solution sets for the differential equation dy/dx = x^2 + 2x "); float x0,xn,y0,e; int n; printf("Step Size: "); scanf("%d",&n); printf("Initial x: "); scanf("%f,%f",&x0); printf("Initial y: "); scanf("%f",&y0); printf("Range of x: "); scanf("%f,%f",&xn); e=euler(x0,xn,y0,n); } float func(float x,float y) { return x*x-6*x; } float euler(float x0,float xn,float y0,int n) { float x,y,h; int i; x=x0; y=y0; h=(xn-x0); printf("y(%f)=%6.4f ",x0,y0);
for(i=1;i
I NEED to obtain a linear regression y=ax+b and show the r^2 values.
Develop a C-code to meet the requirements below: 1) Find the solution of the differential equation below by using Euler's method. The range of x is 2 to 3 dy/dx-x2-6x with y 5 at x-2 the appropriate step size for this specific problem. 2) Find 3) Print all the y values within the range ofx-2 to x-3 4) Solve the differential equation analytically and compare with the Euler's method 5) Obtain a linear regression y-ax+b and show the r value Develop a C-code to meet the requirements below: 1) Find the solution of the differential equation below by using Euler's method. The range of x is 2 to 3 dy/dx-x2-6x with y 5 at x-2 the appropriate step size for this specific problem. 2) Find 3) Print all the y values within the range ofx-2 to x-3 4) Solve the differential equation analytically and compare with the Euler's method 5) Obtain a linear regression y-ax+b and show the r value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
