petsc-3.14.5 2021-03-03
Report Typos and Errors

# PetscLinearRegression

Gives the best least-squares linear fit to some x-y data points

### Synopsis

    PetscErrorCode PetscLinearRegression(PetscInt n, const PetscReal x[], const PetscReal y[], PetscReal *slope, PetscReal *intercept)

### Input Parameters

| n | - The number of points
| x | - The x-values
| y | - The y-values

### Output Parameters

| slope | - The slope of the best-fit line
| intercept | - The y-intercept of the best-fit line

### See Also

PetscConvEstGetConvRate()

### Level

intermediate

### Location

src/sys/utils/mathfit.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages