2 1 Octave Octave Window M m.m Octave Window 1.2 octave:1> a = 1 a = 1 octave:2> b = 1.23 b = octave:3> c = 3; ; % octave:4> x = pi x =

Similar documents
Octave

i Matlab. Matlab

1 1 Gnuplot gnuplot Windows gnuplot gp443win32.zip gnuplot binary, contrib, demo, docs, license 5 BUGS, Chang

2009 I 2 II III 14, 15, α β α β l 0 l l l l γ (1) γ = αβ (2) α β n n cos 2k n n π sin 2k n π k=1 k=1 3. a 0, a 1,..., a n α a

Fortran90/95 [9]! (1 ) " " 5 "Hello!"! 3. (line) Fortran Fortran 1 2 * (1 ) 132 ( ) * 2 ( Fortran ) Fortran ,6 (continuation line) 1


i

di-problem.dvi

. sinh x sinh x) = e x e x = ex e x = sinh x 3) y = cosh x, y = sinh x y = e x, y = e x 6 sinhx) coshx) 4 y-axis x-axis : y = cosh x, y = s

, x R, f (x),, df dx : R R,, f : R R, f(x) ( ).,, f (a) d f dx (a), f (a) d3 f dx 3 (a),, f (n) (a) dn f dx n (a), f d f dx, f d3 f dx 3,, f (n) dn f

untitled

(1) (2) (3) (4) HB B ( ) (5) (6) (7) 40 (8) (9) (10)

2.2 h h l L h L = l cot h (1) (1) L l L l l = L tan h (2) (2) L l 2 l 3 h 2.3 a h a h (a, h)

S I. dy fx x fx y fx + C 3 C dy fx 4 x, y dy v C xt y C v e kt k > xt yt gt [ v dt dt v e kt xt v e kt + C k x v + C C k xt v k 3 r r + dr e kt S dt d

USB ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

S I. dy fx x fx y fx + C 3 C vt dy fx 4 x, y dy yt gt + Ct + C dt v e kt xt v e kt + C k x v k + C C xt v k 3 r r + dr e kt S Sr πr dt d v } dt k e kt

( ) a, b c a 2 + b 2 = c : 2 2 = p q, p, q 2q 2 = p 2. p 2 p q 2 p, q (QED)

2009 IA 5 I 22, 23, 24, 25, 26, (1) Arcsin 1 ( 2 (4) Arccos 1 ) 2 3 (2) Arcsin( 1) (3) Arccos 2 (5) Arctan 1 (6) Arctan ( 3 ) 3 2. n (1) ta

I A A441 : April 21, 2014 Version : Kawahira, Tomoki TA (Kondo, Hirotaka ) Google

y π π O π x 9 s94.5 y dy dx. y = x + 3 y = x logx + 9 s9.6 z z x, z y. z = xy + y 3 z = sinx y 9 s x dx π x cos xdx 9 s93.8 a, fx = e x ax,. a =

68 A mm 1/10 A. (a) (b) A.: (a) A.3 A.4 1 1

fx-3650P_fx-3950P_J

() x + y + y + x dy dx = 0 () dy + xy = x dx y + x y ( 5) ( s55906) 0.7. (). 5 (). ( 6) ( s6590) 0.8 m n. 0.9 n n A. ( 6) ( s6590) f A (λ) = det(a λi)

IA 2013 : :10722 : 2 : :2 :761 :1 (23-27) : : ( / ) (1 /, ) / e.g. (Taylar ) e x = 1 + x + x xn n! +... sin x = x x3 6 + x5 x2n+1 + (

II 2 3.,, A(B + C) = AB + AC, (A + B)C = AC + BC. 4. m m A, m m B,, m m B, AB = BA, A,, I. 5. m m A, m n B, AB = B, A I E, 4 4 I, J, K

Appendix A BASIC BASIC Beginner s All-purpose Symbolic Instruction Code FORTRAN COBOL C JAVA PASCAL (NEC N88-BASIC Windows BASIC (1) (2) ( ) BASIC BAS

(3) (2),,. ( 20) ( s200103) 0.7 x C,, x 2 + y 2 + ax = 0 a.. D,. D, y C, C (x, y) (y 0) C m. (2) D y = y(x) (x ± y 0), (x, y) D, m, m = 1., D. (x 2 y

1 8, : 8.1 1, 2 z = ax + by + c ax by + z c = a b +1 x y z c = 0, (0, 0, c), n = ( a, b, 1). f = n i=1 a ii x 2 i + i<j 2a ij x i x j = ( x, A x), f =

I, II 1, A = A 4 : 6 = max{ A, } A A 10 10%

1 1.1 Excel Excel Excel log 1, log 2, log 3,, log 10 e = ln 10 log cm 1mm 1 10 =0.1mm = f(x) f(x) = n

No2 4 y =sinx (5) y = p sin(2x +3) (6) y = 1 tan(3x 2) (7) y =cos 2 (4x +5) (8) y = cos x 1+sinx 5 (1) y =sinx cos x 6 f(x) = sin(sin x) f 0 (π) (2) y

コンピュータ概論

数学の基礎訓練I

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co

Part () () Γ Part ,

N88 BASIC 0.3 C: My Documents 0.6: 0.3: (R) (G) : enterreturn : (F) BA- SIC.bas 0.8: (V) 0.9: 0.5:

04.dvi

( ) sin 1 x, cos 1 x, tan 1 x sin x, cos x, tan x, arcsin x, arccos x, arctan x. π 2 sin 1 x π 2, 0 cos 1 x π, π 2 < tan 1 x < π 2 1 (1) (

matlab_basic.pptx

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 初版 1 刷発行時のものです.

GraphicsWithPlotFull.nb Plot[{( 1), ( ),...}, {( ), ( ), ( )}] Plot Plot Cos x Sin x, x, 5 Π, 5 Π, AxesLabel x, y x 1 Plot AxesLabel

sin cos No. sine, cosine : trigonometric function π : π = 3.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin : odd cos = cos : even.

( z = x 3 y + y ( z = cos(x y ( 8 ( s8.7 y = xe x ( 8 ( s83.8 ( ( + xdx ( cos 3 xdx t = sin x ( 8 ( s84 ( 8 ( s85. C : y = x + 4, l : y = x + a,

pdf

OABC OA OC 4, OB, AOB BOC COA 60 OA a OB b OC c () AB AC () ABC D OD ABC OD OA + p AB + q AC p q () OABC 4 f(x) + x ( ), () y f(x) P l 4 () y f(x) l P

fx-JP700_fx-JP900

ft. ft τfτdτ = e t.5.. fx = x [ π, π] n sinnx n n=. π a π a, x [ π, π] x = a n cosnx cosna + 4 n=. 3, x [ π, π] x 3 π x = n sinnx. n=.6 f, t gt n 3 n


1. 1 BASIC PC BASIC BASIC BASIC Fortran WS PC (1.3) 1 + x 1 x = x = (1.1) 1 + x = (1.2) 1 + x 1 = (1.

[ ] 0.1 lim x 0 e 3x 1 x IC ( 11) ( s114901) 0.2 (1) y = e 2x (x 2 + 1) (2) y = x/(x 2 + 1) 0.3 dx (1) 1 4x 2 (2) e x sin 2xdx (3) sin 2 xdx ( 11) ( s

) a + b = i + 6 b c = 6i j ) a = 0 b = c = 0 ) â = i + j 0 ˆb = 4) a b = b c = j + ) cos α = cos β = 6) a ˆb = b ĉ = 0 7) a b = 6i j b c = i + 6j + 8)

1W II K =25 A (1) office(a439) (2) A4 etc. 12:00-13:30 Cafe David 1 2 TA appointment Cafe D

I No. sin cos sine, cosine : trigonometric function π : π =.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin : odd cos = cos : even.


.3. (x, x = (, u = = 4 (, x x = 4 x, x 0 x = 0 x = 4 x.4. ( z + z = 8 z, z 0 (z, z = (0, 8, (,, (8, 0 3 (0, 8, (,, (8, 0 z = z 4 z (g f(x = g(

4 4 4 a b c d a b A c d A a da ad bce O E O n A n O ad bc a d n A n O 5 {a n } S n a k n a n + k S n a a n+ S n n S n n log x x {xy } x, y x + y 7 fx

入試の軌跡

1 1.1 ( ). z = a + bi, a, b R 0 a, b 0 a 2 + b 2 0 z = a + bi = ( ) a 2 + b 2 a a 2 + b + b 2 a 2 + b i 2 r = a 2 + b 2 θ cos θ = a a 2 + b 2, sin θ =

I No. sin cos sine, cosine : trigonometric function π : π =.4 : n =, ±, ±, sin + nπ = sin cos + nπ = cos sin = sin : cos = cos :. sin. sin. sin + π si

I y = f(x) a I a x I x = a + x 1 f(x) f(a) x a = f(a + x) f(a) x (11.1) x a x 0 f(x) f(a) f(a + x) f(a) lim = lim x a x a x 0 x (11.2) f(x) x

< 1 > (1) f 0 (a) =6a ; g 0 (a) =6a 2 (2) y = f(x) x = 1 f( 1) = 3 ( 1) 2 =3 ; f 0 ( 1) = 6 ( 1) = 6 ; ( 1; 3) 6 x =1 f(1) = 3 ; f 0 (1) = 6 ; (1; 3)

arctan 1 arctan arctan arctan π = = ( ) π = 4 = π = π = π = =

z f(z) f(z) x, y, u, v, r, θ r > 0 z = x + iy, f = u + iv C γ D f(z) f(z) D f(z) f(z) z, Rm z, z 1.1 z = x + iy = re iθ = r (cos θ + i sin θ) z = x iy

I 1

Transcription:

1 1 Octave GNU Octave Matlab John W. Eaton 1992 2.0.16 2.1.35 Octave Matlab gnuplot Matlab Octave MATLAB [1] Octave [1] 2.7 Octave Matlab Octave Octave 2.1.35 2.5 2.0.16 Octave 1.1 Octave octave Octave Octave octave:1> quit octave:1> exit Octave Ctrl-c Ctrl c

2 1 Octave Octave Window M m.m Octave Window 1.2 octave:1> a = 1 a = 1 octave:2> b = 1.23 b = 1.2300 octave:3> c = 3; ; % octave:4> x = pi x = 3.1416 octave:5> format long octave:6> x x = 3.14159265358979 octave:7> format short octave:8> x x = 3.14 octave:9> format octave:10> x x = 3.1416 octave:11> format long e octave:12> x x = 3.14159265358979e+00 octave:13> format short e octave:14> x x = 3.14e+00 octave:15> format % % % long % short % % long % short 1 i, j, I, J

1.3. 3 octave:16> y = 1+2i y = 1 + 2i octave:17> z = i z = 0 + 1i octave:18> z*z ans = -1 octave:19> printf("hello, Octave\n"); hello, Octave octave:20> x = pi; octave:21> printf("variable x = %f\n",x); variable x = 3.141593 octave:22> y = 1 + 2i; octave:23> printf("complex y = %f + %fi\n",real(y),imag(y)); complex y = 1.000000 + 2.000000i 1.3 1 2 3 A = 4 5 6 7 8 9 Octave Window octave:1> A = [1 2 3;4 5 6;7 8 9] A = 1 2 3 4 5 6 7 8 9 ; Octave M file1.m

4 1 Octave A = input( Enter matrix A ) file1.m Octave pwd Octave Window octave:1> file1 Enter matrix A [1 2 3;4 5 6;7 8 9] A = 1 2 3 4 5 6 7 8 9 A [ ] A=[1 2 3;4 5 6;7 8 9]; 1. [ 1 2 3 4 5 A = 6 7 8 9 10 ] B = 1 2 3 4 5 1 1 C = 2 2 0 0 1.4 A, B X = A + B Y = A - B X = A*B A, B A t X = A*t A t A

1.4. 5 X = A A k k X = A^k 1.1 A, B A + B, A B 1 2 3 1 1 1 A = 4 5 6, B = 2 2 1 7 8 9 1 2 1 A = input( Enter matrix A ) B = input( Enter matrix B ) X = A + B Y = A - B Enter matrix A [1 2 3; 4 5 6; 7 8 9] A = 1 2 3 4 5 6 7 8 9 Enter matrix B [1-1 1; 2 2-1; -1 2 1] B = 1-1 1 2 2-1 -1 2 1 X = 2 1 4 6 7 5 6 10 10 Y = 0 3 2 2 3 7 8 6 8

6 1 Octave 1. A, B AB 1 [ ] (1) A = 1 1 1 1, B = 2 3 AB =10 4 [ ] 1 1 [ ] 1 2 3 4 (2) A =, B = 2 2 5 6 7 8 3 3 AB = 30 4 70 4 4 4 1 1 1 1 6 (3) A = 0 1 1, B = 2 AB = 5 0 0 1 3 3 2. A, k A k [ ] [ ] 2 1 38 41 (1) A =, k =5 1 2 41 38 [ ] [ 2 1 0.12 0.16 (2) A =, k = 2 1 2 0.16 0.12 ] 1.5 A X = inv(a) Octave 1.1 help octave:1> help inv http://www.octave.org/doc/octave toc.html Ax = b

1.5. 7 1.1: norm rank det inv eig expm x = A\b 1.2 1 2 1 Av = λv, A = 2 1 1 4 2 0 octave:1> A = [1 2 1;2 1-1;4 2 0] A = 1 2 1 2 1-1 4 2 0 octave:2> [V,lambda] = eig(a) V = -0.57735 0.54944 0.40825 % V = [v1 v2... vn] 0.57735 0.13736-0.40825 0.57735 0.82416 0.81650 lambda = -2.00000 0.00000 0.00000 % lambda 0.00000 3.00000 0.00000 0.00000 0.00000 1.00000 octave:3> lambda = eig(a) % lambda = -2.00000 3.00000 1.00000

8 1 Octave 1. X XA = I 1 2 1 1 (1) A = 0 1 3 2 1 1 2 1 0 0 1 1 0.2 0.4 0.8 0.2 X = 0.5 0.5 0.5 0 0.1 0.3 0.1 0.4, A =10 0.1 0.3 0.1 0.6 1 0 1 1 1 1 A = 1 1 1 X = 1 1 0, A = 1 1 1 0 0 1 1 2. [ ] [ 1 0 (1) A = 2 (2) A = 0 1 1 0 2 (3) A = 0 1 2 2 1 0 2 16 2 3 13 (4) A = 5 11 10 8 9 7 6 12 3 4 14 15 1 1 1 1 1 (5) A = 1 2 3 4 1 3 6 10 4 1 4 10 20 1 0 1 0 1 1 ] 2 3. A e A [ ] [ 0 1 (1) A = e A = 1 1 1 1 0 (2) A = 0 1 1 0 0 1 e A = ] 0.65970 0.53351 0.53351 0.12619 0.36788 0.36788 0.18394 0 0.36788 0.36788 0 0 0.36788

1.6. 9 1.6 n X = I(n n) X = eye(n,n) 0(n m) zeros(n,m) 1 n m ones(n,m) D = 1 0 0 0 0 0 9 0 0 0 0 0 4 0 0 0 0 0 4 0 0 0 0 0 2 v=[1 9 4 4 2]; D=diag(v,0) 1.7 1.7.1 if, else, elseif if 1.3 a, b b 0 y = a/b (1.1) a = input( Enter a ); b = input( Enter b ); if b ~= 0 y = a/b endif

10 1 Octave 1.4 x { 1 if x 0 y = 1 if x<0 (1.2) x=input( Enter x ); if x >= 0 y = 1; else y = -1; endif y 1.5 x 1 if x>0 y = 0 if x =0 1 if x<0 (1.3) x=input( Enter x ); if x > 0 y=1; elseif x<0 y=-1; else y=0; endif y if if elseif if while 1.2

1.7. 11 1.2: < < <= > > >= == = = 1.7.2 switch 1.6 n n = 1 minus one n =0 zero n =1 one other value n=input( Enter n ); switch n case -1 disp( minus one ); case 0 disp( zero ); case 1 disp( one ); otherwise disp( other value ); endswitch switch n=input( Enter n ); switch n case 1 disp( 1 ); case {2,3,4}

12 1 Octave disp( 2 or 3 or 4 ); case 5 disp( 5 ); otherwise disp( other value ); endswitch 1.7.3 while while while statements endwhile while statements while break 1.7 a ɛ =0.001 2 eps=0.001; a=input( Enter a ); while a>=eps a=a*0.5 endwhile 1.7.4 for for for index = start : increment : end statements endfor index increment statements end increment =1 1.8 n 1 n

1.7. 13 n=input( Enter n ); s = 0; for i = 1:n s = s + i; endfor s for break C goto Octave MATLAB endif endswitch endwhile endfor end 1. x n y =1+x + x 2 + + x n a = 1; y = 1; for i = 1:n a = a*x; y = y + a; endfor 2. x( x < 1) ɛ y =1+x + x 2 + x k <ɛ 3. n n n! =1 2 3 n

14 1 Octave y = 1; for i = 1:n y = y*i; endfor x = 1:n; y = prod(x) % x 4. n, r(n r) nc r = n(n 1)(n 2) (n r +1) 1 2 3 r 5. x ɛ ɛ (1) y =1+x + x 2 /2! + x 3 /3! + x =2 y 7.38906 (2) y =1 x 2 /2! + x 4 /4! + x =2 y 0.41615 (3) y = x x 3 /3! + x 5 /5! + x =2 y 0.90930 6. ɛ ɛ (1) y = 1 1 2 + 1 2 3 + 1 + (= 1) 3 4 (2) y = 1 2 1 3 + 1 2 3 1 3 5 + 1 2 3 4 (= 1 3 5 7 + π ) 2 1.8 1.8.1 x(i) A(i,j) n [ ] x = 1 2 n

1.8. 15 x = []; for i=1:n x(i) = i; endfor x = x x = 1:n Octave octave:1> x = linspace(0,1,5) % [0, 1] (5-1) x = 0.00000 0.25000 0.50000 0.75000 1.00000 octave:2> y = logspace(-1,1,5) % [1e-1, 1e+1] (5-1) y = 0.10000 0.31623 1.00000 3.16228 10.00000 n Jordan J n (λ) Jordan λ 1 0 0 λ 1 0 J 3 (λ) = 0 λ 1 J 4 (λ) = 0 λ 1 0 0 0 λ 1 0 0 λ 0 0 0 λ n=input( Enter n ); lambda=input( Enter lambda ); J=eye(n,n)*lambda; for i=1:n-1 J(i,i+1) = 1; endfor J 1.8.2 A

16 1 Octave d=size(a) A 3 4 d = 3 4 d(1)=3 d(2)=4 A Z Z=zeros(size(A)) A 1 S S=ones(size(A)) 1.8.3 A B C [ ] C = A B C = [A B] C = [ A B ] C = [A;B] A i X X = A; X(:,i)=[] A i X X = A; X(i,:)=[]

1.8. 17 A i j X X = A; X(:,i:j)=[] 1.9 ẋ(t) =Ax(t)+Bu(t) (1.4) A(n n) B(n r) U c := [ B AB A n 1 B ] (1.5) (A, B) 0 1 0 1 A = 0 0 1, B = 0 1 0 0 1 n=input( Enter n ); A=input( Enter A ); B=input( Enter B ); Uc=B; X=B; for i=1:n-1 X=A*X; Uc=[Uc X]; endfor Uc Enter n 3 Enter A [0 1 0; 0 0 1; 1 0 0] Enter B [1;0;1] Uc = 1 0 1 0 1 1 1 1 0

18 1 Octave 1. n [ ] 1 2 3 1 2 R 1 =1 R 2 = R 3 = 0 4 5 0 3 0 0 6 2. v =[ 1 1 1 1 ] diag(v,1), diag(v,-1), diag(v,2), diag(v,-2) 3. n 1 2 0 D =... 0 n n = input( Enter n ); v = 1:n; D = diag(v,0) 4. ẋ(t) = Ax(t) y(t) = Cx(t) } (1.6) A(n n) C(m n) C CA U o :=. CA n 1 (1.7) (A, C) 0 1 0 [ ] 1 0 0 A = 0 0 1, C = 1 0 0 U o = 0 1 0 1 0 0 0 0 1

1.8. 19 5. ẋ(t) = Ax(t)+Bu(t) y(t) = Cx(t) } (1.8) n rank U c = n, rank U o = n (1.9) 0 1 0 0 0 A = 0 0 0 1 0 1 0 0, B = 0 [ ] 0, C = 1 0 1 0 1 0 0 1 1 rank U c =3, rank U o =4 6. A(n n), x(n 1) x(k +1)=Ax(k), x(0) = x 0, k =0, 1,... k =0, 1,...,t f A, x 0,t f [ ] [ ] A = 0.8 1 1, x 0 = 0 0.8 1, t f =20 x = input( Enter x ); tf = input( Enter tf ); A = [0.8 1; 0 0.8] y = []; for i = 1:tf+1 y(:,i) = x; x = A*x; endfor y 7. y(k +2)+a 1 y(k +1)+a 0 y(k) =0, y(0) = y 0, y(1) = y 1, k =0, 1,... y(k), k=0, 1,...,t f a 0 =0.25, a 1 = 1, y(0) = 1, y(1) = 1, t f =20

20 1 Octave 8. n 1, 1, 2, 3, 5, 8,... 1 = 2 =1 i i 2 i 1 n 9. x n [ ] y = 1 x x 2... x n 10. [0, 1] n x 1,x 2,x 3,..., x n n=input( Enter n ); x = rand(1,n) xmax = max(x) xmin = min(x) y = sort(x) % 1 n % % % 11. [0, 1] n x 1,x 2,x 3,..., x n sort 1.9 sin, cos sin(t) t y = []; i = 0; for t = 0:0.1:10 i = i + 1; y(i) = sin(t); endfor y = y

1.9. 21 1.3: sin(x) cos(x) tan(x) asin(x) acos(x) atan(x) atan2(y,x) sinh(x) cosh(x) tanh(x) exp(x) log(x) log10(x) sqrt(x) abs(x) real(x) imag(x) sign(x) sin x cos x tan x arcsin x arccos x arctan x 4 sinh x cosh x tanh x e x ln x log 10 x x x t = 0:0.1:10; y = sin(t); Octave t, y grid "on" plot(t,y) 1.1 1.3 1.10 y(t) =e 0.5t cos 5t (1.10) t [0, 10] 0.01

22 1 Octave 1 line 1 0.8 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 0 2 4 6 8 10 1.1: y =sint t = 0:0.01:10; y = exp(-0.5*t).*cos(5*t); grid "on" plot(t,y).* 1.2 1 line 1 0.8 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8 0 2 4 6 8 10 1.2: y = e 0.5t cos 5t 1.11 1.3 f(x) = 4k 13 15 (sin x + sin 3x + sin 5x + ) π (1.11)

1.9. 23 n [ 10, 10] 0.02 f(x) k 2π π 0 π 2π k x 1.3: 1.5 line 1 1 0.5 0-0.5-1 -1.5-10 -5 0 5 10 1.4: 1.11 k =1,n=5 k = input( Enter k ); n = input( Enter n ); x = -10:0.02:10; y = zeros(size(x)); a = 1; for i=1:n y = y + sin(a*x)/a; a = a + 2; endfor

24 1 Octave y = y*4*k/pi; grid "on" plot(x,y) 1. 1.5 f(x) = π 2 4 (cos x + π 13 2 cos 3x + 15 2 cos 5x + ) (1.12) n [ 10, 10] 0.02 f(x) π 2π π 0 π 2π π x 1.5: 1.10 1.4 1.10.1 Octave p(x) = x 4 +20x 2 20x + 5 (1.13) octave:1> p = [-1 0 20-20 5] =0 roots

1.10. 25 1.4: roots poly poly polyval polyvalm polyfit conv deconv residue octave:2> r = roots(p) r = -4.92606 3.89858 0.57356 0.45393 octave:3> p1 = poly(r) p1 = 1.0000e+00-2.2760e-15-2.0000e+01 2.0000e+01-5.0000e+00 poly A 0 1 0 A = 1 0 0 0 1 2 octave:4> A = [0 1 0; -1 0 0; 0-1 2]; octave:5> p2 = poly(a) p2 = 1-2 1-2 p 2 (x) = xi A = x 3 2x 2 + x 2

26 1 Octave p(x) x =1 polyval octave:6> y = polyval(p,1) y = 4 1.12 polyval p(x) = x 4 +20x 2 20x +5 x [ 5, 5] 0.02 p =[ -1 0 20-20 5]; x = -5:0.02:5; y = polyval(p,x); grid "on" plot(x,y) 200 line 1 150 100 50 0-50 -100-150 -200-250 -6-4 -2 0 2 4 6 1.6: p(x) = x 4 +20x 2 20x +5 1.10.2 polyfit n [ ] x = 0 1 2 3 4 5 6 7 8 9 10

1.11. 27 [ y = 0 3 4 10 18 27 41 59 79 93 101 ] n n = input( Enter n ); x = 0:10; y = [0 3 4 10 18 27 41 59 79 93 101]; p = polyfit(x,y,n) x1 = 0:0.1:10; y1 = polyval(p,x1); grid "on" plot(x,y, +,x1,y1) % (x,y) + o,*,x % (x1,y1) n =3 1.7 120 line 1 line 2 100 80 60 40 20 0 0 2 4 6 8 10 1.7: 1.11 1.13 n x 1,x 2,,x n x σ 2 x = 1 n x i (1.14) n i=1

28 1 Octave σ 2 = 1 n (x i x) 2 (1.15) n i=1 x [ ] x := x 1 x 2 x n x x, σ 2 heikin.m function [a, b] = heikin(x) % a: b: n = length(x); % x a = sum(x)/n; % sum(x): b = sum((x-a).^2)/n; endfunction octave:1> x = rand(1,5) x = 0.70536 0.31711 0.52546 0.80152 0.14361 octave:2> [mean,sigma2] = heikin(x) mean = 0.49861 sigma2 = 0.058838.m function help M MATLAB endfunction

1.12. 29 1.12 fprintf fscanf C C octave:1> x = 0:0.1:1; octave:2> y = [x; exp(x)]; octave:3> fid = fopen("exp.dat, w ); octave:4> fprintf(fid, %6.2f %12.8f \n,y); octave:5> fclose(fid); exp.dat 0.00 1.00 0.10 1.11 0.20 1.22 0.30 1.35 0.40 1.49 0.50 1.65 0.60 1.82 0.70 2.01 0.80 2.23 0.90 2.46 1.00 2.72 exp.dat a octave:6> fid = fopen("exp.dat"); octave:7> a = fscanf(fid, %f %f,[2 inf]); octave:8> a = a ; octave:9> fclose(fid); % It has two rows now. fopen "r" [2 inf] 2

[1] MATLAB http://www.ecs.shimane-u.ac.jp/ kyoshida/matlab.htm, 2001. [2] John W. Eaton: GNU Octave A high-level interactive language for numerical computations Edition 3 for Octave version 2.0.5, http://www.octave.org/doc/octave toc.html, 1997. [3] 1978. [4] 30 30 1988 [5] 1987. [6] pp.470-477, 2000. [7] 1987. [8] 2000. [9] 2001. [10] Octave/Matlab 2000. Octave 2002 2 1 c