MatLab , , , .
, , . MatLab , . , plot, title, axis, text, hist, contour . , , . . , , .
y=f(x), - x , plot. plot y(x) , x y .
-4 4.
3.2-1 |
>>x = -4:.01:4; >>y = sin(x); >>plot(x,y); >> |
(. 3.2-1).
x 0.01, y - . MatLab Figure 1. , MatLab : ; < Alt+Tab> .
. 3.2-1. y=sin(x)
x 0.01, y - . MatLab Figure 1. , MatLab : ; < Alt+Tab> .
y=e−x2
[-1.5;1.5].
3.2-2 |
>> x = - 1.5:.01:1.5; >> y = exp(-x.ˆ2); >> plot(x,y) >> |
. 3.2-2. y=e−x2
, (^), , .
|
|
MatLab , .
3.2-3 |
>> t=0:.001:2*pi; >> x=cos(3*t); >> y=sin(2*t); >> plot(x,y) >> |
. 3.2-3. ,
plot() :
plot(y):
y - , y y;
y - , , .
plot(x,y)
x y - ( ), y x;
x - , y - , y x; y , x, , x; y , x, , x; y , x;
x -, y -, , y x , ;
x y - , , y x.
plot() . , plot() .
, plot() , plot(x1,y1,x2,y2,...), , , .
MatLab , , . . . , title(' ') . gtext('') , . Xlabel('X'), Ylabel('Y').
, .
3.2-4 |
>> x=0:.01:2*pi; >> y1=sin(x); >> y2=sin(2*x); >> y3=sin(4*x); >> plot(x,y1,x,y2,x,y3) >> |
3.2-4b |
>> x=0:.01:2*pi; >> Y=[sin(x), sin(2*x), sin(4*x)]; >> plot(x,Y) >> |
, . 3.2-4. , Y, .
3.2-4. y1=sin(x); y2=sin(2*x);y3=sin(4*x);
holdon, , . , . holdoff , plot , .
|
|
, .
3.2-5 |
>> x=0:.01:2*pi; >> y1=sin(x); >> y2=sin(2*x); >> y3=sin(4*x); >> plot(x,y1,--,x,y2,:,x,y3,+) >> |
, , - , - + (. 3.2-12). x,y,s, x y - , s , - 3.2-5.
. 3.2-5. Sin(x), Sin(2x) Sin(3x)
. 3. 2-1
S | S | ||
y | . | ||
m | o | : | |
c | x | x- | |
r | + | ||
g | * | ||
b | s | ||
w | d | ||
k | v | () | |
() | - | ||
< | () | ||
> | () | -. | - |
p | - | ||
h |
, , , . , , , . xmin, ymin, . axis. . 2.5-9.
, - , , subplot(m,n,p). m , , n , p - . subplot , . plot . , 3.2-6 . sin(x), - log(abs(sin(x))). , x=0 log(0). , −1 ≤ x ≤ 0.1 0.1 ≤ x ≤ 1.
3 .2 -2
axis([xminxmaxyminymax]) | x y . Inf, . , -Inf. |
axis(square) | . |
axis(equal) | x y. |
axis(normal) | . |
axis(ij) | . x- , y- . |
axis(xy) | y . |
axis(tight) | . |
axis(off) | , |
axis(on) | . |
|
|
3.2-6 |
>> x= -1:.1:1; >> y1=sin(x); >> subplot(2, 1, 1), plot(x, y1); >> y2=log(abs(y1)); >> subplot(2, 1, 2), plot(x,y2); >> |
.3.2-6.
(ρ,θ) P (. 3.2-7) ρ - , P, θ, . - .
.
, , plot polar:
3.2-7 | ||
>> phi=0:0.1:2*pi; >>ro=5*(i+cos(phi)); >> polar(phi,ro); >> title {''); >> | ||
=5 . 3.2-7.
.3.2-7.
, . loglog ( ), semilogx ( x), semilogy ( ).
3.2-7 |
>> x=0:10:100; >> y=exp(x); >>semilogy(x,y) >> |
.3.2-8.
. 3.2-8.
plot fplot, y=f(x) (x1,x2,) (y1,y2,...). :
fplot (@name_fun, [limits])
fplot (' name_fun', [limits])
name_fun, - . limits [xminm], [xminxmaxyminymax]. , - . :
fplot(@sin, [0 2*pi])
fplot('sin', [0 2*pi])
plot fplot , - . fplot , 0,2%. , fplot - , 1:
fplot(@sin, [0 2*pi], 0.05)
, 5%. 2・10−3, , , .
|
|
n , fplot n+1 . :
fplot(@sin, [0 2*pi], 0.05, 20)
fpiot(@sin, [0 2*pi], 20, 0.05)
, plot, , . . . 3.2-16.
3.2-9 |
>>fplot(@sin, [0 2*pi], 0.05, 's--') >> |
. 3.2-9. , c fplot
fplot , :
[ ] = fplot(@sin, [0 2*pi]);
, x y .
f, fplot, , , y=f(x,a1,a2). :
fplot('nanie_fun, [xl 2], 0.05, 20, al, a2)
3.2-10, . 3.2 -10.
3.2-10 |
>> subplot (1, 2,1); >>fplot('[tan(x),sin(x),cos(x)]',2*pi*[-l 1 -1 1]); >> subplot (2, 2,2); >>fplot('sin(l / x)', [0.01 0.1); >> |
. 3.2-10. fplot
fplot() y x plot(). , , . , f(x). , f(x), MatLab / . f(x) , x, , , x.
, y = sin(x)cos(2x) x 0 5π, fplot (sin(x).*cos(2x), [0 5*pi]).
( , ) plotyy(x1,y1,x2,y2) 'f1' 'f1','f2', plot, semilogx,semilogx, loglog (. 3.2-11).
3.2-11 |
>> x=0:0.01:12*pi; >>plotyy(x,sin(x).*exp(-0.1.*x),x, 10*exp(-0.1.*x)) % |
. 3.2-11.
xlabel, ylabel, title text. xlabel , ylabel . text, title. , gridon .
3.2-12, . 3.2-12.
3.2-12 |
>> x=1.5: 0.1: 2.5; >> y=sin(x); >> title ( sin(x)); >>xlabel(); >>ylabel(sin(x)); >> text(2.1,0.9,f(x)=sin(x)); >>grid on >>plot(x, y) >> |
. 3.2-12
MatLab , . , ( plot() line()) stairs() yi, i i + 1, stairs(y), xi xi+1, stairs(x,y). xi . , [xs,ys]=stairs(x,y). plot(),line() - .