.


:




:

































 

 

 

 


MATLAB .

, . MATLAB . 1x1, , , , . MATLAB , . MATLAB , . , MATLAB .

MATLAB :

,

-

(. 1) . :

;

, [ ].

:

= [16 3 2 13; 5 10 11 8; 967 12; 4 15 14 1]

MATLAB , ,

A =

16 3 2 13

5 10 11 8

9 6 7 12

4 15 14 1

, MATLAB. . , MATLAB, , . ?

, , . - , - , . , MATLAB. , -

sum ()

MATLAB

ans =

34 34 34 34

, MATLAB ans, answer - , . -, . , , , 34. ? , , . . .

sum(A') '

-,

ans = 34

diag, .

Diag (A)

ans = 16

sum (diag ())

ans = 34

, , ,

MATLAB . ,

, fliplr,

.

Sum(diag(fliplr(A)))

ans = 34

i j A(i,j). ,

(4,2) - .

(4,2) = 15. ,

,

A(1,4) + (2,4) + (3,4) + (4,4)

ans = 34

.

, A(k). . . , .

, , (8) - 15, (4,2).

, MATLAB :

t=A(4,5)

??? Index exceeds matrix dimensions.

, ,

.

X=A;

X(4,5) = 17

X =

16 3 2 13 0

5 10 11 8 0

9 6 7 12 0

4 15 14 1 17

: - MATLAB.

.

1:10

- -, 1 10

123456789 10

, .

100:-7:50

100 93 86 79 72 65 58 51

0:pi/4:pi

0.7854 1.5708 2.3562 3.1416

, , .

A(1:k, j)

k j - .

sum(A(l:4,4))

. . ,

, , end

.

sum ( (:, end))

ans = 34

, MATLAB

,

, MATLAB .

:

MATLAB . MATLAB , . , MATLAB . ,

num_students = 25

1x1 num_students 25

.

, . MATLAB

31 . MATLAB

, . -

. ,

.

2.1

MATLAB ,

- .

.

i j .

3 -99 0.0001

9.6397238 1.60210e-20 6.02252e23

1i -3.14159j 3e5i

- 16

10-308

10308

2.2

.

+

*

/

Λ

'

()

2.3

[ ] ;

;

,

;

; ,

() ;

: (

) ;

% ;

! DOS

.

2.4

MATLAB , abs, sqrt, exp, sin. : . MATLAB

, . . ,

help elfun ,

help specfun

help elmat

.

, sqrt sin, - .

MATLAB, ,

. , gamma

sink, -.

, , .

.

pi 3.14159265...

i , √-1

j , i

realmin , 2-1022

realmax , (2-ε)21023

Inf

NaN

, , .. realmax.

(NaN) / Inf-

Inf, .

,

,

eps = 1.e-6

.

clear eps

MATLAB

, .

.

3.1

plot , ,

plot(y) -

. ,

plot(x,y) .

, sin

2π,

t = 0:pi/100:2*pi;

= sin(t);

plot(t,)

 

 
 

 

plot -

. MATLAB (

, ),

. , ,

:

2 = sin(t-.25);

= sin(t-.5);

plot(t, , t, y2, t, )

 

 
 

 

, ,

,

plot(x, , '__')

__ 1-, 2-, 3- (

), , :

, : '', '', '', 'r', 'g', b', 'w'

'k'. , , , , , ,

.

, : ' - ' , ' '

, ': ' , ' -. ' ' '

.

'+','','*'''.

,

plot(x,y,'y:+')

' + '

. ,

, MATLAB .

plot (

), . , plot

. ,

figure

, -

figure(n)

n - .

.

hold .

hold on

MATLAB , ,

, . ,

peaks,

:

[x,y,z] = peaks;

contour(χ,,z,20,'k')

hold on

pcolor(x,y,z) shading interp

hold on , pcolor

contour

3.2

subplot

.

subplot(m,n,p)

m n n-

. ,

.. , ,

:

t = 0:pi/10:2*pi;

[Χ,Υ,Ζ] = cylinder(4*cos(t));

subplot(2,2,1)

mesh(X)

subplot(2,2,2); mesh(Y)

subplot(2,2,3);mesh(Z)

subplot(2,2,4); mesh(X,Y,Z)

3.3

axis ,

.

MATLAB

. axis

, .

axis([xmin xmax ymin ymax])

axis

.

axis square

χ ,

axis equal

χ .

plot(exp(i*t))

axis square, axis equal

.

axis auto

.

axis on

.

axis off

.

grid off

,

grid on

.

3.4

xlabel, ylabel, zlabel ,

title , text

.

, .

.

t = -pi:pi/100:pi;

= sin(t);

plot(t,)

axis([-pi pi -1 1])

xlabel(' -\pi \leq \itt \leq \pi ')

ylabel(' sin(t) ')

title(' sin ')

text(-l, -1/3, ' \it{ } ')

3.5 mesh surface

MATLAB ζ

-, .

mesh surface

.

mesh ,

, surface

.

3.6

, z = f (x,y), X Y,

,

.

. meshgrid ,

x , X Υ

. X

, Υ - .

sinc, sin(r)/r, -

[Χ, Υ] = meshgrid(-8:.5:8);

R = sqrt(X.^2+Y.^2)+eps;

Ζ = sin(R)./R; mesh (Χ, Υ, Ζ)

R - ,

. eps /

.

,

.

load durer whos

, durer.mat demo 648

509 ( X) 128 3 ( ).

X - 1 128,

, .

imag(X)

colormap(map)

axis image

. ,

, .

load detail

''

image, colormap axis.

colormap(hot)

.

3.6

Print File print

MATLAB. Print ,

. print

-. , ,

.

, PostScript.

,

PostScript Level 2 Encapsulated magicsquare.eps:

print -depsc2 magicsquare.eps

print.

, Postscript Level 2

, Postscript Level 1. , Postscript

Level 2, ,

. MATLAB

, - .

, MATLAB,

.

.

,

, Fixedsys Courier,

.

103

10-3, MATLAB

short long. format,

format compact

, .

.

, sprint/ /print/.

Return Enter, MATLAB

.

, MATLAB , .

. ,

A = magic(100);

, ,

Return Enter, ,

.

s = l -1/2 + 1/3 -1/4 + 1/5 - 1/6 + 1/7... -1/8 + 1/9 - 1/10 + 1/11 - 1/12;

=, +, - , .

, , .

, ,

rho = (1 + sqt(5))/2

sqrt. MATLAB

Undefined function or variable 'sqt'.

, , .

. ←

r.

.

, ,

.

MATLAB

MATLAB ,

MATLAB, , ,

.

5.1

- , MATLAB.

, who whos,

. who , whos

.

, w hos,

, .

MATLAB.

,

.

whos

Name Size Bytes Class

A 4x4 128 double array

D 5x3 120 double array

Μ 10x1 3816 cell array

S 1x3 442 struct array

h 1x11 22 char array

η 1x1 8 double array

s 1x5 10 char array

ν 2x5 20 char array

Grand total is 471 elements using 4566 bytes.

MATLAB,

clear

5.2 save

save -,

load

MATLAB. ,

save Augustl7th

Augustl7th.mat.

, ,

.

MATLAB.

help

MATLAB Help Desk

The MathWorks, Inc.

help

help -

. .

help magic

MAGIC Magic square.

MAGIC(Ν) is an N-by-N matrix constructed from the integers 1 through

ΝΛ2 with equal row, column, and diagonal sums. Produces valid magic

squares for N = 1,3,4,5,...

MATLAB

, . ,

, MATLAB

, .

MATLAB

MATLAB . ,

matfun.

,

help matfun

Matrix functions - numerical linear algebra.

Matrix analysis.

norm - Matrix or vector norm,

normest - Estimate the matrix 2-norm.

lookfor

lookfor .

, H1,

MATLAB H1, .

, MATLAB inverse.

Help inverse

inverse.m not found.

Lookfor inverse

. ,

toolboxes , .

INVHILB Inverse Hubert matrix.

ACOS Inverse cosine.

ACOSH Inverse hyperbolic cosine.

ACOT Inverse cotangent.

ACOTH Inverse hyperbolic cotangent.

ACSC Inverse cosecant.

ACSCH Inverse hyperbolic cosecant.

ASEC Inverse secant.

ASECH Inverse hyperbolic secant.

ASIN Inverse sine.

ASINH Inverse hyperbolic sine.

ATAN Inverse tangent.

-all lookfor, , ,

lookfor -all

,

H1.

, ,

PDF (Portable Document Format) Help Desk.

Adobe's Acrobat reader.

, , ,

.

.

 



<== | ==>
| double
:


: 2017-03-18; !; : 335 |


:

:

, .
==> ...

1373 - | 1297 -


© 2015-2024 lektsii.org - -

: 0.246 .