第4章 データをプロットしてみよう

[Pages:21] 4

MATLAB 1 visualization MATLAB 2

Octave gnuplot Octave

copyright c 2004 Tatsuya Kitamura / All rights reserved.

35

4

4.1 1

1 y = 2x x -5 5 x y plot 4.1 "Figure No. 1" figure window

>> x=-5:5; >> y=2*x; >> plot(x,y)

4.1: y = 2x (-5 x 5)

plot plot

MATLAB closeMAT Octave closeplotOCT

X plot(y) X 12...11 X

X Y

36

4.2.

>> x2=-3:3; >> y2=2*x+1; >> plot(x,y,x2,y2)

>> x=-5:-5; >> Y=2*x; Y=[Y; 2*x+1]; Y=[Y; 2*x+2]; >> plot(x,Y)

4.2

grid linegrid MATLAB grid on grid off Octave grid "on"grid "off"

MATLAB grid toggle 2 grid grid Octave grid

Octave grid "on" replotOCT

octave:4> grid "on" octave:5> replot

grid off replotOCT

4.3

MATLAB Octave plot

37

4

POINT plot

1

plot(X , Y , ' ')

plot(X1 , Y1 , ' ', X2 , Y2 , ' ', ...)

MATLAB Octave

4.3.1 MATLAB

MATLAB 4.1 4.2 4.3 MATLAB

dotted green g :

>> plot(x,y,'g:')

solid solid -

cyan cs

>> plot(x,y,'cs')

-. 4.2

>> plot(x,y,'cs-.')

TRY

38

4.3.

4.1: MATLAB

y

yellow

g

green

m

magenta

b

blue

c

cyan

w

white

r

red

k

black

4.2: MATLAB

-

solid

:

dotted

-.

dashdot

--

dashed

4.3: MATLAB

.

?

v

o

^

x

?

<

<

+

+

>

>

*

p

s

4

h

6

d

10

8

6

4

2

0

-2

-4

-6

-8

-10

-5

-4

-3

-2

-1

0

1

2

3

4

5

4.2: x=-5:5; y=2*x; plot(x,y,'cs-.'); grid on

39

4

4.3.2 Octave

Octave 4.4 4.5 4.6

dots plot style green g . lines plot style -

octave:1> x=-5:5; y=2*x; octave:2> plot(x,y,'g.')

4.4 plot(x,y,'2.')

cyan c3

octave:3> plot(x,y,'c3')

plot(x,y,'53')

linespoints plot style-@ dots plot style

octave:4> plot(x,y,'c3-@.')

Octave gnuplot gplotOCT Octave 1

4.4: Octave

1 r red 4 m magenta

2 g green 5 c cyan

3 b blue 6 w brown

1, "gnuplot ", (1999).

40

4.4.

4.5: Octave

-

lines plot style

.

dots plot style

@

points plot style

-@

linespoints plot style

^

impulses plot plot style

L

steps plot style

4.6: Octave

1 o

4 x

?

2 +

+

5

3

4 6 *

TRY

Tips

plot(x,y,'r+-')

plot(x,y,'r+',x,y,'b-')

2

plot(x,y,'r+',x,y,'b-',x,y,'y--')

4.4

X Y label

title 1

y = sin()

10

sin

>> omega=0:pi/10:4*pi; >> plot(omega,sin(omega))

X Y xlabel ylabel title

41

4

UNIX MATLAB Windows MATLAB

>> xlabel('omega [rad]'); ylabel('y') >> title('sin(omega)')

MATLAB LATEX 2 LATEX 4.7 4.8

y = sin() 4.3

>> xlabel('\omega [rad]'); ylabel('y') >> title('sin(\omega) (0 \leq \omega \leq 4\pi)')

y

sin() (0 4)

1

0.8

0.6

0.4

0.2

0

-0.2

-0.4

-0.6

-0.8

-1

0

2

4

6

8

10

12

14

[rad]

4.3:

Octave 4.2 grid

4.5

Octave MATLAB legendMAT

2Octave

42

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download