Dastur kodi:
#include
using namespace std;
double z1_max = 200, z1_min = 100, z1_0 = 150, delta_z1 = 50;
double z2_max = 60, z2_min = 20, z2_0 = 40, delta_z2 = 20;
double z3_max = 30, z3_min = 10, z3_0 = 20, delta_z3 = 10;
double z0[123456], delta_z[132456];
int x[10][10] = {
{1,-1,-1,-1},
{1,1,-1,-1},
{1,-1,1,-1},
{1,1,1,-1},
{1,-1,-1,1},
{1,1,-1,1},
{1,-1,1,1},
{1,1,1,1}};
int z[10][10] = {
{100,20,10},
{200,20,10},
{100,60,10},
{200,60,10},
{100,20,30},
{200,20,30},
{100,60,30},
{200,60,30}};
int y[8] = {1,3,2,6,4,5,9,8};
main(){
cout<<"X Matritsa\n";
for(int i=0; i<8; i++)
{
for(int j=0; j<4; j++)
{
if(x[i][j] == 1)
cout<<" ";
cout<}
cout<}
cout<cout<<"---//---//---//---\n";
cout<<"Z Matritsa\n";
for(int i=0; i<8; i++)
{
for(int j=0; j<3; j++)
{
if(z[i][j] == 1)
cout<<" ";
cout<}
cout<}
cout<<"---//---//---//---\n";
cout<<"Y massiv\n ";
for(int i=0; i<8; i++)
cout<cout<cout<<"---//---//---//---\n";
cout<
int n=4, k=18;
for(int i=1; i<=k; i++)
z0[i]=i;
for(int i=1; i<=n; i++)
delta_z[i]=i;
double b0=4, b1=3, b2=8;
double X[k+1];
for(int i=1; i<=k; i++)
{
X[i] = (z0[i] - z1_0)/delta_z1;
}
double y = b0+b1*X[1]+b2*X[2];
cout<<"Regressiya tenglamasi natijasi\n";
cout<}
Dastur natijasi:
1-etap kodi:
Dasturning kodi(C++ da):
#include
using namespace std;
double x,w,s,c,P,A,E;
int n=7;
double m_x,m_w,m_c,m_P,m_A,m_E;
int a[] = {2,4,6,8,10,12,14};
int main ()
{
///O`rta arifmetik
for(int i=1; i<=n; i++)
{
x+=a[i];
}
x/=n;
cout<<"1.O`rta arifmetik x="<///O`rta kvadratik chetlanish
double summ=0;
for (int i=1; i<=n; i++)
{
summ+=(a[i]-x)*(a[i]-x);
}
w=sqrt(summ/n);
cout<<"2.O`rta kvadratik chetlanish w="<///Variatsiya koeffitsiyenti
summ=0;
for(int i=1; i<=n; i++)
{
summ+=fabs(a[i]-x);
}
s=summ/n;
c=w*100./n;
cout<<"3.Variatsiya koeffitsiyenti c="<///Aniqlik ko`rsatkichi
P=w*100./x/sqrt(n*1.);
cout<<"4.Aniqlik ko`rsatkichi P="<
///Assimmetrik ko`rsatkichi
summ=0;
for(int i=1; i<=n; i++)
{
summ+=(a[i]-x)*(a[i]-x)*(a[i]-x);
}
A=summ/n/w/w/w;
cout<<"5.Assimmetrik ko`rsatkichi A="<///Ekssess
summ=0;
for(int i=1; i<=n; i++)
{
summ+=pow((a[i]-x),4);
}
E=summ/n/pow(w,4);
cout<<"Ekssess E="<///O`rtacha arifmetik xatolik
m_x=w/sqrt(1.*n);
cout<<"7.O`rtacha arifmetik xatolik m_x="<///O`rtacha kvadratik chetlashish xatoligi
summ=0;
for(int i=1; i<=n; i++)
{
summ+=(a[i]-x)*(a[i]-x);
}
w=sqrt(summ/n);
cout<<"8.O`rtacha kvadratik chetlashish xatoligi w="<
/// Variatsiya xatoligi
summ=0;
for(int i=1; i<=n; i++)
{
m_c=(c/sqrt(2.*n)*sqrt(1+2*c/100));
}
cout<<"9.Variatsiya xatoligi m_c="</// Aniqlik ko`rsatkichi xatoligi
for(int i=1; i<=n; i++){
double m_P=P*sqrt(1./2*n+pow(P/100,2));
}
cout<<"10.Aniqlik ko`rsatkichi xatoligi m_P="<///Assimmetriya xatoligi
for(int i=1; i<=n; i++){
m_A=sqrt(w/n);
}
cout<<"Assimmetriya xatoligi m_A="</// Ekssess xatoligi
for(int i=1; i<=n; i++){
m_E=2*m_A;
}
cout<<"12.Ekssess xatoligi m_E="<///Normal taqsimot qonunini taqribiy kriteriyasi
for(int i=1; i<=n; i++){
double m_A=sqrt(E*(n-1.)/(n+1.)/(n+3.));
}
for(int i=1; i<=n; i++){
double m_E=sqrt(24*(n-2.)*(n-3.)*n/(n-1)/(n-1)/(n+3)/(n+5));
}
cout<<"13.Normal taqsimot qonunini taqribiy kriteriyasi:"<cout<<"w_A="<cout<<"w_E="<}
2-etap kodi:
#include
using namespace std;
int n = 7;
int x[] = {2,4,6,8,10,12,14};
int main()
{
int S=0,xx=0;
/// Dispersiya
for(int i=1; i<=n; i++)
{
xx+=x[i];
}
xx=xx*1.0/n;
int summ=0;
for(int i=1; i<=n; i++)
{
summ+=pow(x[i]-xx,2);
S=summ/(n-1);
}
int S1=0,yy=0,y[] = {1,2,3,4,7,6,5};
for(int i=1; i<=n; i++)
{
yy+=y[i];
}
yy=yy*1.0/n;
int summ1=0;
for(int i=1; i<=n; i++)
{
summ1+=pow(y[i]-yy,2);
S1=summ1*1.0/(n-1);
}
double sigma_x=sqrt(xx/n-xx/n/n);
double sigma_y=sqrt(yy/n-yy/n/n);
double S_x=sqrt(S);
double S1_y=sqrt(S1);
double S2=abs(xx/n-xx/n/n);
double S3=abs(yy/n-yy/n/n);
double C_x=sigma_x/S2;
double C_y=sigma_y/S3;
double R_x1_y1=0,a = 0,a1 = 0,b1 = 0,x1y1[]= {2,4,6,8,10,12,14},x1[] = {3,4,6,8,2,4,10},y1[] = {6,4,6,9,2,1,7};
for(int i=1; i<=n; i++)
{
a+=x1y1[i];
a1+=x1[i];
b1+=y1[i];
}
for(int i=1; i<=n; i++)
{
double R_x1_y1=(n*a-a1*b1)/sqrt(n*x1[i]*x1[i]-a1*a1)*sqrt(n*y1[i]*y1[i]-b1*b1);
}
cout<<"Dispersiya:"<
cout<<"S="<cout<<"S1="<cout<<"O`rta kvadratik chetlanish:"<cout<<"sigma_y="<cout<<"sigma_x="<cout<<"Standart chetlanish:"<cout<<"S_x="<cout<<"S1_y="<cout<<"Variatsiya koeffitsiyenti:"<cout<<"C_x="<cout<<"C_y="<cout<<"Korrelyatsiya koeffitsiyenti:"<cout<<"R_x1_y1="<
return 0;
}
3-4-etap kodi:
#include
using namespace std;
int main()
{
int m = 7;
int y[] = {2,4,6,8,10,12,14};
double summ=0 ;
for (int i=1; i<=m; i++)
{
summ+=y[i];
}
double Y_i=summ/m;
cout<<"summ="<cout<<"Y_i="<//2.Dispersiya tanlangan bahosi aniqlanadi
double summ1=0;
for(int j=1; j<=m; j++)
{
summ1+=(summ-pow(Y_i,2));
}
double S_i2=summ1/(m-1);
cout<<"S_i2="<//Tanlangan dispersiyani yig`indisini hisoblash
double S_y2=0;
int n = 7;
for(int i=1; i<=n; i++)
{
S_y2+=S_i2;
}
cout<<"S_y2="<//Quyidagi nisbat hisoblanadi
double Cmax=S_i2/S_y2;
cout<<"Cmax="<//4-etap:Kuzatuv dispersiyasi kuzatiladi
double SS=0;
for(int i=1; i<=n; i++)
{
SS+=S_i2;
}
double S=SS/n;
cout<<"S="<
//Qoldiq dispersiya xisoblanadi
double S_oct=m*pow((summ-Y_i),2)/n;
cout<<"S_oct="<//Quyidagi nisbat aniqlanadi
double F=pow(S_oct,2)/S;
cout<<"F="<return 0;
}Dastur natijasi:
Foydalanilgan adabiyotlar
Xulosa
Men bu laboratoriya ishida obyektni tartiblangan statestik modelni qurish imkonyati bo`lmaganda mazkur obyektni o`rganish maqsadida uning emerik modelini qurish uchun tajriba –statistik usullaridan foydalanishni o`rgandim.Bu fo`rmulalardan foydalanib regresiya tenglamasini hisobladim.
Do'stlaringiz bilan baham: |