Você está na página 1de 2

Computacin Aplicada a la Ingeniera

Mnimos cuadrados - 1

Anlisis de regresin
REGRESION LINEAL. y = A + B.x

y B x

n
DATOS: T,C
LONGITUD, mm

Respuesta :

n x y x y
n x 2 x
10
1003

15
1005

n x y x y

n x

20
1010

n y

25
1011

30
1014

A = 997.4 ; B = 0.56 r = 0.982607368

REGRESION LOGARITMICA. y = A + B.ln x


Regresin Lineal
x
x2
x.y
DATOS: xi
yi

Regresin Logartmica
(Ln x)
(Ln x)2
(Ln x).y

29
50
74 103 118
1.6 23.5 38.0 46.4 48.9

Respuesta : A = -111.1283976 ; B = 34.02014749 ; r = 0.994013946


REGRESION EXPONENCIAL. y = A.eB.x (ln y = ln A + B.x)
Regresin Lineal
y
y2
x.y
DATOS: xi 6,9
yi 21,4

Regresin Exponencial
(Ln y)
(Ln y)2
x.(Ln y)
12,9 19,8 26,7 35,1
15,7 12,1 8,5 5,2

RPTA : Averdadero = eA obtenido = 30.49758742 ; B = -0.049203708 ; r = 0.997247351


REGRESION DE POTENCIA. y = A.xB (ln y = ln A + B.ln x)
Regresin Lineal
x
x2
y
y2
x.y
DATOS: xi 28
yi 2410

Regresin de Potencia
(Ln x)
(Ln x)2
(Ln y)
(Ln y)2
(Ln x.Ln y)
30
3033

33
3895

35
4491

38
5717

RPTA : Averdadero = eA obtenido = 0.238801082 ; B = 2.771866148 ; r = 0.998906256

Prof.: Heber Helfer

Computacin Aplicada a la Ingeniera

Mnimos cuadrados - 2

#include<iostream.h>
#include<stdlib.h>
int main()
{
float x,y,a,b,r,sx=0,sy=0,sxy=0,sx2=0,sy2=0;
int i,n;
cout << "Regresion Lineal\nIngreso de Datos x,y\n";
cout << "# de Pares de Datos : ";
cin >> n;
// Lectura de los valores x,y
for(i=1;i<=n;i++)
{
cout << "x(" << i << ") = ";
cin >> x;
cout << "y(" << i << ") = ";
cin >> y;
sx = sx + x;
sy = sy + y;
sxy = sxy + x*y;
sx2 = sx2 + x*x;
sy2 = sy2 + y*y;
}
// Calculo de las Constantes
b = (n*sxy - sx*sy)/(n*sx2 - sx*sx);
a = (sy - b*sx)/n;
r = (n*sxy - sx*sy)/sqrt((n*sx2-sx*sx)*(n*sy2-sy*sy));
cout << "\nTermino de la Constante de Regresion A : " << a << endl
<< "Coeficiente de Regresion B : " << b
<< "\nCoeficiente de Correlacion r : " << r
<< "\nEc. de la Recta : y = " << a << " + " << b << "*x";
system("PAUSE");
return 0;
}

Prof.: Heber Helfer

Você também pode gostar