You are on page 1of 6

MATLAB

MATLAB MATLAB
MATLAB

21
211
MATLAB

3
99 0.002
1.3e-2
4.5e33
MATLAB MATLAB
ans format
format MATLAB
4
Format long
14
Format long e
Format short e
MATLAB 12.3,
format (short)5 12.3000
format long15
12.30000000000000
format short e e 1.2300e+001
format long e e 1.230000000000000e+001
format bank2 12.30
format hex
help format
212
MATLAB MATLAB
1. myvar MyVar
2. 31 myvar31
3. my_var_31
MATLAB 2.1 MATLAB
2.1

MATLAB

ans

eps

MATLAB =2.2204e-16

pi

inf
NaN

1
0

( )
0
0

( )

i j

i = j = 1

nargin

nargout

realmax

realmin

flops

22 MATLAB
MATLAB
1.

2.
... 4*sin(0.3)*8
>> 4*sin(0.3)*...
8
ans =
9.4566

2.3

MATLAB

MATLAB help elfun MATLAB MATLAB

sin

csc

atanh

cos

asec

acoth

tan

acsc

sech

cot

sinh

csch

asin

cosh

asech

acos

tanh

acsch

atan

coth

atan2

acot

asinh

sec

acosh

exp

log10

10

pow2

log

log2

sqrt

abs

conj

real

imag

angle

ceil

rem

fix

round

floor

sign

mod

MATLAB help datafun

min

max

mean

median

std

diff

sort

norm
prod

length

Euclidean

sum

dot

cumsum

cross

gradient

cumprod
cov

24 MATLAB

MATLAB (True)
(False) 1 0
MATLAB

MATLAB

<

<=

>

>=

==

~=

MATLAB a b
>> a=1:2:15;b=2:1:9;
a[1 3 5 7 9 11 13 15];b=[2 3 4 5 6 7 8 9] a b
a b a b ans
>> a>b
ans =
0

>> a==b
a b
ans =
0

>> a-(b>3)
b 3b>3 1 0 a b>3
ans
ans =
1

10

12

14

&

and

or

not

>> (a<2)|(b>6)
a<2 a<2 1 0 b>6
b>6 1 0a<2b>6
ans =
1

10

xor

1 0

any

0 1 0

all

1 1 0

isnan

NaN 1 0

isinf

inf 1 0

isfinite

1 0

ischar

1 0

isequal

1 0

ismember

1 0

isempty

1 0

isletter

1 0

isstudent

isprime

1 0

isreal

1 0

isspace

1 0

>> isequal(a,b)
a b
ans =
0
>> isreal(a)
a
ans =
1

2.1 MATLAB a=6.3, a


format (short)5
format long15
format short e e
format bank2
2.2 1 MATLAB help elfun help datafun MATLAB
2 x=[89.2 83.4 88.5 91.2
84.1 80.4 91.5 92.7 94.0 93.1]
x x
3 y0.25pi b= ceil(y),c=fix(y),d=4*sin(y)*log(y)
11

2.3

MATLAB a b a=1:2:15;b=1:1:8; a b a-(b>3)


(a<2)|(b>6)

12

You might also like