TP-probabilites/TP1/calcul_parametres.m
2023-06-10 21:01:20 +02:00

17 lines
402 B
Matlab

## 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