. , .
=[-2,-1,0,1,2]
V=sin(x); V =-0.9093 -0.8415 0 0.8415 0.9093
V=tan(x); V=exp(x) .
1) () (+, -);
2) (.*);
3) (./,.\)
4) .(.^)
, , , , , . Matlab .
, :
- ;
- .
:
=[1 2 3 4 5; 6 7 8 9 11]
A= 1 2 3 4 5
6 7 8 9 11
B=[0 -1 -2 -3 -4; 5 6 7 8 9]
B = 0 -1 -2 -3 -4
5 6 7 8 9
A+B
ans = 1 1 1 1 1
11 13 15 17 20
-B
ans = 1 3 5 7 9
1 1 1 1 2
*5
ans = 5 10 15 20 25
30 35 40 45 55
ans = 1 6
2 7
3 8
4 9
5 11
A*B
ans = 30 35 40 45 50
35 40 45 50 55
40 45 50 55 60
45 50 55 60 65
50 61 67 73 79
inv (A)
. .
^2
Matlab .(/ \)
\ inv(A)*B, : *=.
:
x1 + 2x2 + 3x3 = 14
2x1 - x2 - 5x3 = -15
x1 - x2- x3 = - 4
A=[1 2 3; 2 -1 -5; 1 -1 -1]
A= 1 2 3
2 -1 -5
1 -1 -1
B = [14; -15; -4]
B = 14
-15
- 4
x = A \ B
x = 1
x1 =1 x2 =2 x3 = 3 .
Matlab .
() :
Matlab , an 0
P = [an a2 a1 a0]
n+1, n .
Matlab roots(P) , , .
|
|
:
() = 5+8x4+31x3+80x2+94x+20
P=[1 8 31 80 94 20]
Roots(P)
-1.0000+3.0000i
-1.0000+3.0000i
-3.7321
-2.0000
-0.2679
poly.
P = poly(R),
R , .
:
P = [1 8 31 80 94 20]
P = 1 8 31 80 94 20
R= roots (P)
R = -1.0000+3.0000i
-1.0000+3.0000i
-3.7321
-2.0000
-0.2679
P1 = poly(R)
P1 = 1.0000 8.0000 31.0000 80.0000 94.0000 20.0000
Matlab polyval. :
y = polyval (, x),
;
x .
P = [1 8 31 80 94 20]
x = 2
y = polyval (P, x)
y = 936
polyder. .
dp = polyder (P)
dp = 5 32 93 160 94
IF
if.... end . , MATLAB if end, end. , MATLAB if end end.
.
if rem(a, 2) == 0
disp('a ')
b = /2;
end