MATLAB / \.
A ⋅ y = B, (1)
A N x N,
B N, \ A \ B.
\ , A B A \ B, inv (A)* B. inv (A) , A. / . A / B B * inv (A). , y ⋅A= B.
F (x)=0, , fzero (name, x0). , , . , , cos(x) 0 pi. x0 =1.
>> x=fzero('cos', 1)
x = 1.5708
, ( MATLAB) MATLAB , , .
, , cos(x)= x, , y =cos(x)− x, MATLAB . Mat
function y=MyFunction1(x)
y=cos(x)-x
fzero:
>> x=fzero('MyFunction1',pi/2)
x = 0.7391
, . , . , fzero fzero (name, x0, tol), tol (). , fzero . , . MATLAB roots( p ), (p). , ( ):
>> p = [ 1 -3 3 -3 2 ]:
>> r = roots(p)
r = 2.0000
-0.0000 +1.0000i
-0.0000 1.0000i
1.0000
, . roots fzero .
|
|
MATLAB . , .
xmin = fmin (name, x0, x1). name , , x0 x1 . fmins: xmins = fmins (name, x0). name , , x0 , . (0,0).
function = MyFunc2()
= x(1)^2+ x(2)^2;
fmins, xmin :
>> xmin = fmins('MyFunc2', [1,1]);
>> xmin(1)
ans =-2.1023e-005
>> xmin(2)
ans =2.5484-005
MATLAB trapz: Integ = trapz (, ). : , .
i/10.
>> dx = pi/10;
>> = 0:dx:pi;
>> y=cos(x);
>>I1 = trapz(x,y);
I1 = 5.5511e-017
, . . MATLAB : quad ( c) quad8 ( -- 8- ).
MATLAB dblquad.
.
mat dblquad:
function z = integ(x, )
z = x.*sin(y) + y.*sin(x);
>>J = dblquad('integ', 0, 1, 1, 2);
J = 1.1678
Symbolic Math Toolbox , . syms. , b
syms a b
sym object . , pretty:
5.1 pretty
, simplify.
5.2 simplify
sym, , :
|
|
5.3
, ,
expand, : rez= expand (S), S , , rez .
:
>> syms x y;
>> rezl=expand(sin(x+y))
rezl = sin (x) *cos () +cos (x) *sin (y)
factor ,
>> factor(sym('x^5 1'))
ans =
(-1)*(^4+^3+^2++1)
subs :
5.4 subs
Symbolic Math Toolbox , . int, , (. .5.5).
5.5 int
, , int:
5.6 int
, :
inv ;
limit ;
taylor ;
solve .
funtool. , . 5.7. : . , x, .
5.7 funtool
1. f1 (x) = 0 f2 (x) = 0 5.1.
2. , 5.2.
5.1
3- a | |||||
-1 | -1 | ||||
-2 | -15 | ||||
-1 | |||||
-8 | -70 | ||||
-4 | |||||
-5 | |||||
-3 | |||||
-6 | |||||
-9 | |||||
-7 | |||||
-1 | -4 | ||||
-2 | -6 | -7 | |||
-3 | -9 | -8 | |||
-4 | -75 | ||||
-5 | -1 |
5.2
-2 | |||
-2 | |||
-2 | |||
-2 | |||
-0.5 | 4.5 | ||
-1.4 | 1.4 | ||
-5 | |||
-5 | |||
-4 | |||
-2 | |||
-2 | |||
5.2 | |||
-2 | |||
-1 | |||
-2 | |||
-2 |
|
|
3. , 5.2 .
1. .
2. .
1. fmin?
2. fzero?
4. MATLAB .
5. ?
6. .
6