Εισαγωγή στην Επιστήμη των Η/Υ ΙΙ Μάθημα 7 Στατιστική...
Embed Size (px)
description
Transcript of Εισαγωγή στην Επιστήμη των Η/Υ ΙΙ Μάθημα 7 Στατιστική...
-
/
7
-
:
1) 2) 3)
: . , , .
-
:
1) ( mean) :
>> x=[1 3 5 7 3];>> mean(x)
ans =
3.8000
2) ( median) : , , , .
>> x=[1 3 5 7 3 5 4 7];>> median(x)
ans =
4.5000
-
3) ( range) :
>> x=[1 3 5 7 3 5 4 7];>> range(x)
ans =
6
4) ( var) :
>> x=[1 3 5 7 3 5 4 7];>> var(x)
ans =
4.2679
5) ( std) :
>> x=[1 3 5 7 3 5 4 7]; >> std(x)
ans = 2.0659
-
6) ( skewness) :
7) ( kurtosis) :
>> x=[1 3 5 7 3 5 4 7];>> skewness(x)
ans =
-0.1218
>> kurtosis(x)
ans =
2.0811
-
Matlab , . , , . :
>> x=[1 2 3;4 5 6;7 8 9] x = 3x3 1 2 3 4 5 6 7 8 9
>> x=[1 2 3 4] ( 1x4)x =
1 2 3 4
-
>> x=[1; 2; 3; 4] ( 4x1)x =
1 2 3 4
( ) :
>> x=[1 2 3;4 5 6;7 8 9]
x =
1 2 3 4 5 6 7 8 9
x . >> x'
ans =
1 4 7 2 5 8 3 6 9
-
, 2 , , / (.*). / , :
x x , ( * ) , x, ij i- j- . :
ij=i11j+22j++j
!! .
-
>> A=[1 3 2;4 7 9;2 3 6]
A =
1 3 2 4 7 9 2 3 6>> B=[2 5 1;3 7 4;6 2 9]
B =
2 5 1 3 7 4 6 2 9>> C=A*B
C =
23 30 31 83 87 113 49 43 68 :>> C_el=A.*B
C_el =
2 15 2 12 49 36 12 6 54 2 , / CC_el *.*
-
-1 ( inv) : , -1 *-1= -1* = . >> A=[1 2 1;1 -1 1;1 1 0]
A =
1 2 1 1 -1 1 1 1 0
>> inv(A)
ans =
-0.3333 0.3333 1.0000 0.3333 -0.3333 0 0.6667 0.3333 -1.0000
: nxn, 1 0 ( eye).
>> eye(3)
ans =
1 0 0 0 1 0 0 0 1
-
( det) : ( ) , ( ), . , , . 2x2 ( 2 )
2x2
|| :
3x3
-
3x3 ( 3 ) 3x3 : : , 3x3 , || . .
-
:>> A=[2 3 -1;4 1 2;1 -1 1]
A =
2 3 -1 4 1 2 1 -1 1
>> det(A)
ans =
5
>> inv(A)
ans =
0.6000 -0.4000 1.4000 -0.4000 0.6000 -1.6000 -1.0000 1.0000 -2.00001) 02) >> A=[2 3 1;4 1 5;1 -1 2]
A =
2 3 1 4 1 5 1 -1 2
>> det(A)
ans =
0
>> inv(A)Warning: Matrix is singular to working precision.
ans =
Inf Inf Inf Inf Inf Inf Inf Inf Inf
-
( eig):
x . , i :| -i | = 0
, ( eye) | -iI | -iI. E, o , j, rj=[r1;r2;..;r], :
(-j) rj = 0
0, , .H atlab eig.
-
: : >> A=[1 3 2;4 7 9;2 3 6]
A =
1 3 2 4 7 9 2 3 6 =eig(A) , :>> E=eig(A)
E =
13.0385 -0.3956 1.3571 :[V,D]=eig(A), Matlab V D . >> [V,D]=eig(A)
V =
-0.2854 -0.9291 -0.6587 -0.8497 0.3470 -0.4701 -0.4433 0.1278 0.5875D =
13.0385 0 0 0 -0.3956 0 0 0 1.3571
-
: a1x1+a 2x2 ++ anxn=b, ai xi , n . ai b . m n , , m n mxn. x=b, , : \.: ( x=[x1 ; x2 ;x3]):
x1+2x2+x3=-1x1-x2+x3=3x1+x2=4
, =[1 2 1; 1 -1 1;1 1 0] b=[-1;3;4] (3x3) det(A)=30
-
>> A=[1 2 1;1 -1 1;1 1 0]
A =
1 2 1 1 -1 1 1 1 0
>> b=[-1;3;4]
b =
-1 3 4
, Matlab, :x=A\b
>> x=A\b
x =
5.3333 -1.3333 -3.6667 o : x1 = 5.3333 x=[x1;x2;x3] : x2 = -1.3333 x3 = -3.6667 , det(A)0.
-
: , . ? 2+3+=2 : A*x=b => 4++5=3 -+2=1
= [2 3 1;4 1 5;1 -1 2] , x=[;;] b=[2;3;1]. >> A=[2 3 1;4 1 5;1 -1 2]
A =
2 3 1 4 1 5 1 -1 2>> b=[2;3;1]
b =
2 3 1
-
>> x=A\bWarning: Matrix is singular to working precision.
x =
-Inf Inf Inf>> det(A)
ans =
0 : , ( ).
-
( trapz) :
, a,b
f(x) , . , , . [a,b] n : x =(ba)/n :x0=a, x1=a+x, x2=a+ 2x ,..., xi=a+ix,..., xn=a+nx=b, , :
-
f(x) , f(x1), f(x2),,f(xn), x1, x2,,xn , f(x) [x1 , xn] trapz(x,y), :
x=[x1;x2;;xn] y=[f(x1);f(x2);;f(xn)]
:
:
>> x = [0 0.1 0.25 0.33 0.46 0.59 0.64 0.78 0.99];>> y = [1.14 13.45 33.99 54.68 55.5 70.0 76.3 81.19 109.7];>> plot(x,y,-o)
To :
>> trapz(x,y)ans = 57.8787
....