17 lines
402 B
Mathematica
17 lines
402 B
Mathematica
|
## Author: Laurent <laurent@pop-os>
|
||
|
## Created: 2020-11-02
|
||
|
|
||
|
function [r, a, b] = calcul_parametres (X, Y)
|
||
|
|
||
|
moyX = mean(X)
|
||
|
moyY = mean(Y)
|
||
|
sigmaX = sqrt( (X - moyX).'*(X - moyX) / size(X)(1) )
|
||
|
sigmaY = sqrt( (Y - moyY).'*(Y - moyY) / size(Y)(1) )
|
||
|
covariance = (X - moyX).'*(Y - moyY) / size(X)(1)
|
||
|
|
||
|
r = covariance/(sigmaX*sigmaY)
|
||
|
a = covariance/(sigmaX^2)
|
||
|
b = moyY - moyX*a
|
||
|
|
||
|
endfunction
|