5 3 copyright c Tatsuya Kitamura / All rights reserved. 57
5 5. 3 MATLAB 3 line plot plot3 MAT plot Z Octave gnuplot splot gsplot OCT 3 splot plot3 MAT plot 5. 5. 5.3 plot 5. >> t=:pi/:*pi; >> plot3(t.*cos(t),t.*sin(t),t) >> grid on >> xlabel( X ); ylabel( Y ); zlabel( Z ); 35 3 5 Z 5 5 3 Y 3 3 X 3 5.: plot3 3 axis 5. 3 3 surface plot mesh surf MAT mesh Octave, gnuplot, (999). 58
5.. 3 MATLAB 3 peaks MAT mesh 5. colorbar MAT >> z=peaks; >> mesh(z) >> grid on; colorbar 8 8 8 5 5 3 3 5.: mesh colormap >> map=colormap; RBG >> colormap( default ) 59
5 5. MATLAB 5.3 hidden MAT >> hidden off 8 8 8 5 3 3 5 5.3: meshc MAT 5. contour plot >> meshc(z); grid on >> colorbar( horiz ) 5 5 5 3 3 5 8 5.: meshc Octave 5. gset OCT
5.3. meshgrid octave:5> mesh(z) octave:> gset contour base octave:7> replot surf MAT surfc MAT peaks MAT 5.5 >> subplot(); surf(z); title( surf ); >> subplot(); surfc(z); title( surfc ); surf surfc 8 5 5 8 5.5: surf surfc Tips hot MATLAB hot hot MAT colormap hot >> colormap(hot) cool MAT flag MAT gray lookfor MAT >> lookfor color map 5.3 meshgrid peaks MAT z = f(x, y)
5 z = x y x y 5 5 meshgrid X Y x y >> [x,y]=meshgrid(-5:5); x y z = x y z.^ vectorize >> z=x.^-y.^; >> mesh(z) >> grid on >> box on box 5. 3 3 8 8 5.: z = x y TRY z =cos(x)+sin(y) mesh x y π π
5.. 5. view 3 5.7 azimuth elevation 5.7: Using MATLAB Graphics POINT MATLAB view(, ) view([, ]) Octave 8 3 gset view, MATLAB 3 37.5 3 view >> [az,el]=view; az el Octave 3 3 Octave gshow view MATLAB view([x Y Z]) 3
5 view 5.8 >> z=membrane; >> mesh(z) >> view(-37.5,) membrane MAT Mathworks 3 view( 37.5,3) view( 37.5,).8....5..5. 3 3 3 3 5.8: Octave gset OCT replot OCT octave:8> gset view 37.5, octave:9> replot TRY.5
5.5. 5.5 X semilogx Y semilogy X Y loglog plot >> x=:; y=.x; >> subplot(); plot(x,y); grid on >> subplot(); semilogy(x,y); grid on >> subplot(3); semilogx(x,y); grid on >> subplot(); loglog(x,y); grid on 8 plot semilogy 3 8 8 8 semilogx loglog 3 5.9: plot semilogx semilogy loglog 5
5 5. bar barh MAT rand 5 3 5. >> data=rand(5,3); >> bar(data) >> grid on data 5 3 X Y colormap bar barh.9 5.8.7..5 3..3.. 3 5....8 5.: bar barh Octave bar plot octave:> data=rand(,3); octave:> [x,y]=bar(data); octave:> plot(x,y) plot(y,x) MATLAB 3 bar stack MAT >> bar(data, stack )
5.. 3 bar3 MAT bar3h MAT stack MAT >> bar3h(data) 5..5 stack bar3h 5.5 3.5.5 3 5 5.: 3 7
5 5.7 hist 5. >> n=randn(,); >> subplot(); hist(n); grid on >> u=rand(,); >> subplot(); hist(u); grid on 3 randn(,) rand(,) 5 8 5 5....8 5.: randn(,) rand(,) Tips diary MAT diary on MATLAB diary off diary diary( filename ) 8
5.8. 5.8 pie MAT 3 pie3 MAT 5.3 MB >> df=[5 95 8 97]; >> pie(df) >> pie(df,{ sda sdf sdd sde sdg sdh }) pie MAT 5.3 >> ex=zeros(size(data)); ex()=; >> pie(df,ex,{ sda sdf sdd sde sdg sdh }) 7% 3% % sdf sda sdh % sdg % sdd 3% sde 5.3: 9
5 5.9 contour plot contour z =cos(x)+sin(y) 5. >> t=-*pi:pi/:*pi; >> [x,y]=meshgrid(t); >> z=cos(x)+sin(y); >> contour(z,) >> axis square contour axis square MAT 3 5.: z =cos(x)+sin(y) clabel MAT contour3 MAT 3 contourf MAT 7
5.. 5. stem MAT x[n] =α n cos(ωn) α =.7 Ω =π >> alpha=.7; omega=pi; >> n=:.:; >> x=alpha.^n.*cos(omega.*n); >> stem(n,x); grid on LATEX >> title( x[n] = \alpha^n cos(\omega n) ) >> xlabel( n ); ylabel( x[n] ); 5.5 x[n] = α n cos(ω n).8... x[n]....8 3 5 7 8 9 n 5.5: x[n] =α n cos(ωn) filled >> stem(n,x, filled ); plot 7