.


:




:

































 

 

 

 


break




while for break.

, , x y y(k) = x(k+1)/x(k) x(k), . . , . x , , x . y x. - break:

function y=div(x)

for k=1:length(x)-1

if x(k)==0

break

end

y(k)=x(k+1)/x(k);

end

 

15. , . . plotyy(), , .

 

16. ( ), fplot(), MATLAB .

fplot() -, , : fplot(' -', [a,b]).

- myfun :

function y=myfun(x);

y=cos(10*x).*(sin(x)+0.1*sin(100*pi*x));

y=myfun(x);

fplot(myfun,[0,1])

17. , .

x(t) y(t), y(x). , :

t;

x(t) y(t);

plot() .

t=[0:0.01:2*pi];

x=sin(t);

y=0.1*cos(t);

plot(x,y)

18. :

) [x;y] . meshgrid(x,y). x y , . , meshgrid() :

) ;

) MATLAB;

) , .

14. z(x,y) = x+y3 (. 5.16), x y [-8;8] 0,5. .

>> [x,y]=meshgrid(-8:0.5:8);

>> z=x+y.^3;

>> plot3(x,y,z,k)

.

) , z . meshgrid() .

) meshgrid() [x,y], .

) plot3() , .

) , , zOy. .

, plot3() plot() 2D .

 

19. MATLAB:

1. File Save As.

2. , .

:

1. , Windows, .

2. File Export.

3. , (). , Windows.

Word [ * .tif] [ * .bmp].

 

20. , y x . (. . ), , . comet(x,y), , , , , ( ). . , . S. comet() comet(x,y,S), S . S 0,1.

, 2D . comet3(x,y,z), x, y z. comet3() , , comet(), .

 

21. sym.

,

>>x=sym('x')

x =

x

'x' .

x=sym('x','real') x . x=sym('x','positive') x () , x=sym('x','unreal') (. . ).

syms.

>> syms a b c

a, b, c.

>> Pi=sym('pi');

Pi = π, π .

, Symbolic ( ) π , , . , sin

>> S=sin(Pi/5)

S =

1/4*2^(1/2)*(5-5^(1/2))^(1/2)

syms , .

vpa:

R=vpa(S) S, D, digits. R sym;

R=vpa(S,D) S D.

digits . :

digits ( 32);

digits(D) D .

22. simplify(S) S. , .

:

>> syms a b x

>>simplify((a^2-2*a*b+b^2)/(a-b))

ans =

a-b

simple.

simple(S) S , . [R,HOW] = simple(S) . R, HOW . :

>> syms x

>> [R,HOW]=simple(cos(x)^2+sin(x)^2)

R =

HOW =

combine

>> [R,HOW]=simple(2*cos(x)^2-sin(x)^2)

R =

3*cos(x)^2-1

HOW =

simplify

>> [R,HOW]=simple(cos(x)^2-sin(x)^2)

R =

cos(2*x)

HOW =

combine

[R] = simple(S):

>> [R]=simple(cos(x)^2-sin(x)^2)

R =

cos(2*x)

. subs :

subs(S) S , MATLAB;

subs(S, NEW) S NEW;

subs(S, OLD, NEW) OLD NEW S. OLD NEW . S OLD , NEW , .

:

>>syms a b x y;

>>subs(x-y,y,1)

ans =

x-1

>>subs(sin(x)+cos(y),[x y],[a b])

ans =

sin(a)+cos(b)

, :

>> s=sym('x^(x+1)');

>> f=subs(s,'x',1.5)

f =

2.7557

vpa:

>> f=subs(s,'x','1.5')

f =

(1.5)^((1.5)+1)

>> vpa(f,40)

ans =

2.7556759606310753604719445840441

23. F(x), () , limit, :

limit(F,x,a) F x = a;

limit(F,x,a,'right') limit(F,x,a,'left') a .

S diff, diff(S, x, n). n - ( n) S x, . .

Sn(x) =.

diff(S, x) (n = 1 ).

S , diff , , .

I = dx I = dx.

f(x) x, a b .

int(f, x) ( ) f x.

int(f, x, a, b) f x b.

f , .

f , int(f, x) , int(f, x, a, b) .

f(x) a:

f(x) =.

a = 0 :

f(x) =.

f ( ) taylor:

taylor(f) . , n - a, , taylor(f,n,x,a).

cos(x):

>> syms x

>> taylor(cos(x))

ans =

1-1/2*x^2+1/24*x^4

>> taylor(cos(x),5,x,2)

ans =

cos(2)-sin(2)*(x-2)-1/2*cos(2)*(x-2)^2+1/6*sin(2)*(x-2)^3+1/24*cos(2)*(x-2)^4

24.

solve(expr1, expr2,..., exprN, var1, var2,..., varN). varI, , exprI. , , exprI = 0.

:

;

.

solve , . , doc solve.

:

x3 - 1 = 0.

:

>> syms x,y=x^3-1;S=solve(y)

S =

[ 1]

[ -1/2+1/2*i*3^(1/2)]

[ -1/2-1/2*i*3^(1/2)]

x1 = 1, x2 =, x3 =, S(1), S(2), S(3) S.

( ) MATLAB

r = dsolve('eq1','eq2',...,'cond1','cond2',...,'v').

eq1, eq2,..., v , () cond1, cond2,.... t, . eqI (condI) , , eqI (condI) = 0.

D , d/dt, D2 d2/dt2 . . D.

'y(a) = b' 'Dy(a) = b', , a b , . . , C1, C2 . . , solve. dsolve , doc dsolve.

:

1) x'' = -2x', 2) y'' = -ax+y', y(0) = b, 3) y(4) - y = 5exsinx+x4, 4) y''+4y'+3y = cost, y(0) = 1, y'(0) = 0.

3 - 4 - .

:

>> dsolve('D2x=-2*x')

ans =

C1*cos(2^(1/2)*t)+C2*sin(2^(1/2)*t)

>> dsolve('D2y=-a*x+y','y(0)=b','x')

ans =

a*x+C1*sinh(x)+b*cosh(x)

 

25. , (, plot), Symbolic ezplot:

ezplot(f) f(x) x [- 2*pi;2*pi];

ezplot(f,xmin,xmax) , x xmin xmax;

ezplot(f, [xmin, xmax, ymin, ymax]) f(x,) = 0 xmin < < xmax, ymin < y < ymax.

f(t) ezpolar:

ezpolar(f) f(t) t 0 ;

ezpolar(f,[a b]) f(t) t a b.

, ezcontour f(x,y). ezcontourf . ezplot3. ezsurf, ezsurfc, ezmesh, ezmeshc , f(x,y). doc < >.

 

26. f(t) t

L(s) = f(t)e-stdt.

f(t) , L(s) . f(t) :

) f(t) t, . ( , . );

) f(t) = 0 t < 0;

) M > 0 p ≥ 0 , tf(t) │ < Mept (pf(t) │).

) 7.1.

7.1.

f(t) L(s) = f(t)e-stdt.
1 s-1
e-at (s+a)-1
sinat a(s2+a2)-1
tn n!s-n-1
e-atcoswt  
tne-at  

 

MATLAB f(t) laplace(F,t,s).

7.1 f(t):

>> syms a t w s

>> n=sym('n','positive');

>> laplace(1,t,s)

ans =

1/s

>> laplace(exp(-a*t),t,s)

ans =

1/(s+a)

>> laplace(sin(a*t),t,s)

ans =

a/(s^2+a^2)

>> laplace(t^n,t,s)

ans =

s^(-n-1)*gamma(n+1)

>> laplace(exp(-a*t)*cos(w*t),t,s)

ans =

(s+a)/((s+a)^2+w^2)

>> laplace(t^n*exp(-a*t),t,s)

ans =

gamma(n+1)*(s+a)^(-n-1)

laplace ( doc laplace).

f(t) = L(s)estds.

MATLAB L(s) ilaplace(L,s,t). 7.1 L(s):

>> syms a t w s

>> n=sym('n','positive');

>> ilaplace(1/s,s,t)

ans =

>> ilaplace(1/(s+a),s,t)

ans =

exp(-a*t)

>> ilaplace(a/(s^2+a^2),s,t)

ans =

a/(a^2)^(1/2)*sin((a^2)^(1/2)*t)

>> ilaplace(s^(-n-1)*gamma(n+1),s,t)

ans =

t^n

>> ilaplace((s+a)/((s+a)^2+w^2),s,t)

ans =

exp(-a*t)*cos(w*t)

>> ilaplace(gamma(n+1)*(s+a)^(-n-1),s,t)

ans =

exp(-a*t)*t^n

27. Maple MATLAB , () .

Maple, LAB, maple.

Symbolic MATLAB Maple Waterloo, MATLAB Maple. Maple 3000 . MATLAB Symbolic, , Maple . , Maple, ( ), Maple.

Maple solve.

:

> 2.

:

>> maple('solve((x-2)/(x+3)>2,{x})')

ans =

{-8 < x, x < -3}

, - 8 < x < - 3 .

:

 

:

>> maple('solve({(x-2)/(x+3)<=51,sqrt(x)*(sqrt(x)-1)<10,10*x^2+4*x>=69},x)')

ans =

{RootOf(-69+10*_Z^2+4*_Z,2.4343879744638981326796776750121) <= x, x < RootOf(-21*_Z+_Z^2+100,13.701562118716424343244108837311)}

>> vpa(ans,4)

ans =

{2.434 <= x, x < 13.70}

, 2,434 ≤ x < 13,70 ( 4 - ).





:


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


:

:

: , , , , .
==> ...

1722 - | 1561 -


© 2015-2024 lektsii.org - -

: 0.157 .