Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Regression
program hello implicit none dimension x(10),y(10) real::slope,sum_x,sum_x2,sum_xy,sum_y,p,x,x_bar,q,y,y_bar,y_int integer::n,i sum_x=0.0 sum_x2=0.0 sum_xy=0.0 sum_y=0.0 read*,n READ(*,*) (X(I),Y(I),I=1,n) DO i=1,n sum_x = sum_x + x(i) sum_y = sum_y + y(i) sum_x2 = sum_x2 + x(i)**2 sum_xy = sum_xy + x(i)* y(i) END DO x_bar = sum_x / real(n) y_bar = sum_y / real(n) slope = (sum_xy - sum_x * y_bar) / ( sum_x2 - sum_x * x_bar) y_int = y_bar - slope * x_bar WRITE (*, 1020 ) slope, y_int, N 1020 FORMAT ('Regression coefficients for the least-squares line:',& /,' slope (m) = ', F12.3,& /,' Intercept (b) = ', F12.3,& /,' No of points = ', I12) end program hello
run
|
edit
|
history
|
help
0
Ghhhb
A_01 NEWTON_RM(B(II))
QE
gauss seidel and jacobi
Factorial problem
euler-cromer
Blasius Euler Code
Ch2 ex1 p15
Inverse matric
Practice 2(I)