TP-probabilites/TP1/calcul_parametres.m

17 lines
402 B
Mathematica
Raw Permalink Normal View History

2023-06-10 19:01:20 +00:00
## 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