-
. . . . -
_____________
1
MATLAB. MATLAB
: . . -312
..
..
..
: . ..
_____________________
-
MATLAB .
1. MATLAB .
, MATLAB?
MATLAB :
Command Window ( )
Workspace ( )
Current Folder ( )
Command history ( )
2. MATLAB HTML.
, ?
HTML MATLAB Help Help MATLAB help < MATLAB>.
3. Command Window.
. ?
- %.
: % MATLAB. MATLAB.
4. MATLAB.
>> help general. help.
MATLAB ?
help ().
>> help general .
5. Command Window.
?
Command Window clc.
6. .
; :
0,0000
0,814
-0,814
8,14×10-7
0,814578942
0,99999999
0,000014765178
8145,7
-8145,577777777
0,8145557×105
:
>> 0
ans =
>> 0.0000
ans =
>> 0.814
ans =
0.8140
>> -0.814
ans =
-0.8140
>> 8.14*10^-7
ans =
8.1400e-007
>> 0.814578942
ans =
0.8146
>> 0.99999999
ans =
1.0000
>> 0.000014765178
ans =
1.4765e-005
>> 8145.7
ans =
8.1457e+003
>> -8145.577777777
ans =
-8.1456e+003
>> 0.8145557*10^5
ans =
8.1456e+004
( ):
>> 0
ans =
>> 0.0000
ans =
|
|
>> 8.14e-1
ans =
0.8140
>> -8.14e-1
ans =
-0.8140
>> 8.14e-7
ans =
8.1400e-007
>> 8.1457894e-1
ans =
0.8146
>> 9.99999999e-1
ans =
1.0000
>> 1.4765178e-5
ans =
1.4765e-005
>> 8.1457e3
ans =
8.1457e+003
>> -8.14557777777e3
ans =
-8.1456e+003
>> 8.145557e4
ans =
8.1456e+004
:
; ?
?
E?
?
?
?
?
?
- ; .
ans.
, ..
4 .
, : format long format long e. .
15.
format, format short e, format long, format long e.
, , .
7. .
; :
0,057+0,5j
0,057+0,5i
1200000,5+56i
1200000,57857+56i
12,5+56i
12,5+0,000056i
-0,99999999i
0i
17+10-5i
15×10-5i
:
>> 0.057+0.5j
ans =
0.0570 + 0.5000i
>> 0.057+0.5i
ans =
0.0570 + 0.5000i
>> 1200000.5+56i
ans =
1.2000e+006 +5.6000e+001i
>> 1200000.57857+56i
ans =
1.2000e+006 +5.6000e+001i
>> 12.5+56i
ans =
12.5000 +56.0000i
>> 12.5+0.000056i
ans =
12.5000 + 0.0001i
>> -0.99999999i
ans =
0 - 1.0000i
>> 0i
ans =
>> 17+10e-5i
ans =
17.0000 + 0.0001i
>> 15*10e-5i
ans =
0 + 0.0015i
:
?
?
?
?
?
.
.
4 .
(format).
0i .
8. .
true false ; .
>> true
|
|
ans =
>> false
ans =
, ?
true 1, false 0. ans.
9. .
:
;
.
>> 'shelamova mariya aleksandrovna'
ans =
shelamova mariya aleksandrovna
>> ' MATLAB. MATLAB'
ans =
MATLAB. MATLAB
, ?
. .
10. .
:
-0,9; 125; 0; 5+3i; 12i;
-0,9; 125; 0; 5; 12;
1; 2; 4; 5; 12;
-:
>> A=[-0.9 125 0 5+3i 12i]
A =
1.0e+002 *
Columns 1 through 4
-0.0090 1.2500 0 0.0500 + 0.0300i
Column 5
0 + 0.1200i
>> A=[-0.9 125 0 5 12]
A =
-0.9000 125.0000 0 5.0000 12.0000
>> A=[1 2 4 5 12]
A =
1 2 4 5 12
- :
>> A=[-0.9; 125; 0; 5+3i; 12i]
A =
1.0e+002 *
-0.0090
1.2500
0.0500 + 0.0300i
0 + 0.1200i
>> A=[-0.9; 125; 0; 5; 12]
A =
-0.9000
125.0000
5.0000
12.0000
>> A=[1; 2; 4; 5; 12]
A =
:
?
L ?
: [ ], ;, ,;
.
11. .
3 3 3 2 .
>> a=[-0.9 125 0; 5 24 24; 544 5 7741]
a =
1.0e+003 *
-0.0009 0.1250 0
0.0050 0.0240 0.0240
0.5440 0.0050 7.7410
>> a=[-0.9 125 0; 5 24 24]
a =
-0.9000 125.0000
5.0000 24.0000
544.0000 5.0000
, ?
.
, . , , .
12. .
, .
>> x=5
x =
>> y=[3 4 4]
y =
3 4 4
>> y=[3 4 4; 8 9 9; 3 5 77]
y =
3 4 4
8 9 9
3 5 77
, MATLAB.
, . MATLAB . .
13. .
i 5.
F 5+3i, : ; .
>> i=5
i =
>> F=5+3i
F =
5.0000 + 3.0000i
>> F=5+3*i
F =
:
?
?
( ). , * . i , i=5.
, .
14. .
.
, , .
- .
|
|
>> x=5+3i;
:
>> abs (x)
ans =
5.8310
:
>> angle (x)
ans =
0.5404
Re(x):
>> real (x)
ans =
Im(x):
>> imag(x)
ans =
:
>> conj(x)
ans =
5.0000 - 3.0000i
, ?
: abs (x), angle (x), real (x),
imag(x), conj(x).
15. .
a, b , .
:
d=a+bsin(π/a+b/c-cosaπ);
e=a2- + + .
MATLAB.
>> a=5;
>> b=3;
>> c=6;
>> d=a+b*sin(pi/a+b/c-cos(a*pi))
d =
7.5457
>> e=((a^2)-sqrt(abs(b))+(c^(1/3)) +((d+a*c)/b))
e =
37.6003
?
, : , , , .
16. .
, . MATLAB.
>> d=a+b*sin((pi/a)+(b/c)-cos(a*pi))>5
d =
>> e=((a^2)-sqrt(abs(b))+(c^(1/3)) +((d+a*c)/b))<40
e =
.
MATLAB.
>> d=not(a>5+(b*sin((pi/a)+(b/c)-cos(a*pi))>5))
d =
>> e=not((a^2)-sqrt(abs(b))+not(c^(1/3)) +((d+((a<6)*c))/b))<40
e =
:
?
?
, : , - .
: 1 (true) 0 (false).
17. .
, Nan Inf.
>> 0/0
ans =
NaN
>> 1/0
ans =
Inf
?
Inf (, MATLAB).
Nan . .
18. .
:
floor([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ceil([8.2 8.5 8.7 -8.2 -8.5 -8.7])
convergent([8.2 8.5 8.7 -8.2 -8.5 -8.7])
nearest([8.2 8.5 8.7 -8.2 -8.5 -8.7])
round([8.2 8.5 8.7 -8.2 -8.5 -8.7])
fix([8.2 8.5 8.7 -8.2 -8.5 -8.7])
?
>> floor([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
8 8 8 -9 -9 -9
>> ceil([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
9 9 9 -8 -8 -8
>> convergent([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
8 8 9 -8 -8 -9
>> nearest([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
8 9 9 -8 -8 -9
>> round([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
8 9 9 -8 -9 -9
>> fix([8.2 8.5 8.7 -8.2 -8.5 -8.7])
ans =
8 8 8 -8 -8 -8
|
|
floor () - ( ).
eil () - + ( ).
onvergent ()- - , 0.5 .
nearest (x) , 0,5 .
round (x) , 0,5 .
fix (x) .
19. .
.
>> x=19;
>> dec2hex(x)
ans =
>> dec2bin(x)
ans =
.
>> bin2dec('10011')
ans =
>> hex2dec('13')
ans =
, ?
: dec2hex(x), dec2bin(x), bin2dec(),hex2dec().
20. .
, work .
>> A=5
A =
>> B=3
B =
>> C=45
C =
>> save lab1 A B C
:
work?
?
?
?
work , .
save.
. , , .
mat.
21. Workspace?
:
Workspace;
, Command Window;
>> load lab1
>> A
A =
>> B
B =
>> C
C =
Workspace;
Workspace Workspace;
>> A
??? Undefined function or variable 'A'.
Workspace.
Workspace .
Workspace , . Workspace .
22. MATLAB.