.


:




:

































 

 

 

 


.




, , ( , ). , , , . plot3, () . , ( , , , ..) MATLAB.

, , () (, , ) (. 2.12.1):

>> t=0:pi/100:10*pi;

>> x=cos(t);

>> y=sin(t);

>> plot3(x,y,t);

>> grid on

. 2.12.1. .

,

plot3(x,y,t)

MATLAB , x, y, t.

plot3, plot, , ( , , ). , , , . 2.12.1 , :

plot3(x,y,t,g:)

plot3, plot, . , . MATLAB ( , ) - .

, . . . MATLAB . , .

MATLAB , X Y. , , X , Y . meshgrid, :

[X Y]=meshgrid(x,y)

x y , ( ) .

, , .. , meshgrid :

[X Y]=meshgrid(x)

Z.

- X Y . x y .

, , , plot3(X,Y,Z).

.

MATLAB , . , , mesh ( ( (wire frame)), ), surf ( , , ) surfl, surface. , , .

. plot3, mesh, surf surfl ( . 2.12.2-2.12.5):

>> x=-2:0.1:2;

>> y=-1:0.1:1;

>> [X,Y]=meshgrid(x,y);

>> Z=exp(-X.^2-Y.^2);

>> plot3(X,Y,Z);

>> hmesh=mesh(X,Y,Z)

>> figure

>> mesh(X,Y,Z);

>> figure

>> surf(X,Y,Z);

>> figure

>> surfl(X,Y,Z);

, surface, mesh, hmesh. get:

>> get(hmesh,'Type')

ans =

surface

, . ( ( ) , ( ) ). , . z ( , , ). ( z ) colormap, ( Figure). -

. 2.12.2. plot3.

. 2.12.3. mesh.

. 2.12.4. surf.

. 2.12.5. surfl.

, , X, Y, Z, CData .

mesh, surf surfl, plot3, . ( )

>> hidden off

, , . ( )

>> hidden on

surf ( ) , () .

shading . :

flat () ;

interp ( ), ;

faceted , .

, , ( surf).

mesh c, , . meshc (. 2.12.6):

>> x=-2:0.1:2;

>> y=-1:0.1:1;

>> [X,Y]=meshgrid(x,y);

>> Z=exp(-X.^2-Y.^2);

>> meshc(X,Y,Z);

>> axis square;

, () axis square, (. 2.12.6).

, surf surfc, , (. 2.12.7).

. 2.12.6. meshc.

. 2.12.7. surf.

>> x=-2:0.1:2;

>> y=-1:0.1:1;

>> [X,Y]=meshgrid(x,y);

>> Z=exp(-X.^2-Y.^2);

>> surfc(X,Y,Z);

.

, , ,

('', )

. , , EdgeColor surface, shading interp:

>> set(hmesh,'FaceColor','interp')

, surface:

>> hmesh=mesh(X,Y,Z)

hmesh =

174.0062

>> get(hmesh)

AlphaData: 1

AlphaDataMapping: 'scaled'

Annotation: [1x1 hg.Annotation]

CData: [21x41 double]

CDataMapping: 'scaled'

DisplayName: ''

EdgeAlpha: 1

EdgeColor: 'flat'

FaceAlpha: 1

FaceColor: [1 1 1]

LineStyle: '-'

LineWidth: 0.5000

Marker: 'none'

MarkerEdgeColor: 'auto'

MarkerFaceColor: 'none'

MarkerSize: 6

MeshStyle: 'both'

XData: [21x41 double]

YData: [21x41 double]

ZData: [21x41 double]

FaceLighting: 'none'

EdgeLighting: 'flat'

BackFaceLighting: 'reverselit'

AmbientStrength: 0.3000

DiffuseStrength: 0.6000

SpecularStrength: 0.9000

SpecularExponent: 10

SpecularColorReflectance: 1

VertexNormals: [21x41x3 double]

NormalMode: 'auto'

BeingDeleted: 'off'

ButtonDownFcn: []

Children: [0x1 double]

Clipping: 'on'

CreateFcn: []

DeleteFcn: []

BusyAction: 'queue'

HandleVisibility: 'on'

HitTest: 'on'

Interruptible: 'on'

Selected: 'off'

SelectionHighlight: 'on'

Tag: ''

Type: 'surface'

UIContextMenu: []

UserData: []

Visible: 'on'

Parent: 173.0057

XDataMode: 'manual'

XDataSource: ''

YDataMode: 'manual'

YDataSource: ''

CDataMode: 'auto'

CDataSource: ''

ZDataSource: ''

, . , , , - , , ( ) . , copper

>> colormap(copper)

, (copper ).

>> surfl(X,Y,Z)

>> shading interp

, . 2.12.8.

, (colormap), : cool ( ), gray ( ( , , - )), hot ( : ), hsv ( ), jet

. 2.12.8. surfl ( copper; shading interp).

( : ( )), copper ( ), autumn ( : ), winter ( ), summer ( ), spring ( ), pink ( ).

colormap(' ')

colormap('default') , .

surfl , , . , gray, copper, pink shading interp.

, , , . , axis, :

axis([xmin xmax ymin ymax zmin zmax])

, , xlabel ( ), ylabel ( ), zlabel ( , ), title ( ) legend ( ), set. , , subplot.

mesh z, .. meshz, , . , , , . 2.12.9, :

>> [X,Y]=meshgrid(-2:0.1:2);

>> Z=X.*exp(-X.^2-Y.^2);

>> colormap(gray)

>> meshz(X,Y,Z)

, , , , , .. , () . , MATLAB , , .

, . : /az/ (.. , ( , , )) /el/ (.. , ). , .

, mesh, surf surfl az=-37.5 () el=30 (). view, :

>> [az,el]=view

az =

-37.5000

el =

. 2.12.9. .

view , , :

view([az,el])

view([x,y,z])

view(2)

view(3)

, , , (az=0 () el=90 ()) (az=-37.5 () el=30 ()) .

, . 2.12.9 view([-20,25]), , 30 25 , -37.5 -20 . , (. 2.12.10).

, .

. 2.12.10. , ( 25 , -20 ).

(. 2.12.11):

>> [X,Y]=meshgrid(-2:0.1:2);

>> Z=-2*X.*exp(-X.^2-Y.^2);

>> surf(X,Y,Z)

>> view(-37.5,-20)

MATLAB Figure.

, () Rotate 3D ( ). , Rotate 3D, , , , , ( ) , az el, . , , -

. 2.12.11. .

, ( , , ). , . 2.12.12 ( view(0,0)).

, , , , colorbar, , . () Insert Colorbar ( ) Figure. , , colorbar Insert Colorbar , . 2.12.11, , . 2.12.13.

, .

, MATLAB, , light. (Ambientlight),

axes ( AmbientLightColor) surface ( AmbientLight).

 

. 2.12.12. .

. 2.12.13. .

, , . 2.12.9,

>> hsurfl=surfl(X,Y,Z)

hsurfl =

174.0081

>> set(hsurfl,'FaceLighting','phong','FaceColor','interp');

>> set(hsurfl,'AmbientStrength',0.5);

>> light('Position',[1 0 0],'Style','infinite');

>> light('Position',[1 0 0],'Style','infinite');

( surface), . , Position, (style=infinite, .. ).

, ( Color light). , , , , . set () ( Color black), . , MATLAB : , - , ( ) .

(, surfl) : az=7.5 () el=30 (). , surfl , . , , , , :

>> [az,el]=view

>> surfl(X,Y,Z,[az,el])

camlight. :

camlight headlight , ;

camlight right ( camlight) , ;

camlight left , ;

camlight(az,el) .

camlight , . , . MATLAB , , material, . material:

material shiny ;

material dull ;

material metal ;

material default , .

MATLAB , , , ( ). , (.., , ). , Camera () . 2.12.14.

. 2.12.14. Camera.

, View, Camera Toolbar. , . , , Camera , , .

, , : , , ( ). .

, , , surface. mesh, surf surfl. surface, , axes, , gca, axes ( , , axes). , set axes, , , , . axes:

>> hA=gca

hA =

173.0057

>> get(hA)

ActivePositionProperty = outerposition

ALim = [0.1 10]

ALimMode = auto

AmbientLightColor = [1 1 1]

Box = off

CameraPosition = [-18.2628 -23.8006 4.33013]

CameraPositionMode = auto

CameraTarget = [0 0 0]

CameraTargetMode = auto

CameraUpVector = [0 0 1]

CameraUpVectorMode = auto

CameraViewAngle = [10.3396]

CameraViewAngleMode = auto

CLim = [-0.428838 0.428838]

CLimMode = auto

Color = [1 1 1]

CurrentPoint = [ (2 by 3) double array]

ColorOrder = [ (7 by 3) double array]

DataAspectRatio = [4 4 1]

DataAspectRatioMode = auto

DrawMode = normal

FontAngle = normal

FontName = Helvetica

FontSize = [10]

FontUnits = points

FontWeight = normal

GridLineStyle =:

Layer = bottom

LineStyleOrder = -

LineWidth = [0.5]

MinorGridLineStyle =:

NextPlot = replace

OuterPosition = [0 0 1 1]

PlotBoxAspectRatio = [1 1 1]

PlotBoxAspectRatioMode = auto

Projection = orthographic

Position = [0.13 0.11 0.775 0.815]

TickLength = [0.01 0.025]

TickDir = out

TickDirMode = auto

TightInset = [0.0571429 0.05 0.0303571 0.00238095]

Title = [175.006]

Units = normalized

View = [-37.5 30]

XColor = [0 0 0]

XDir = normal

XGrid = on

XLabel = [176.006]

XAxisLocation = bottom

XLim = [-2 2]

XLimMode = auto

XMinorGrid = off

XMinorTick = off

XScale = linear

XTick = [-2 -1 0 1 2]

XTickLabel =

-2

-1

XTickLabelMode = auto

XTickMode = auto

YColor = [0 0 0]

YDir = normal

YGrid = on

YLabel = [177.006]

YAxisLocation = left

YLim = [-2 2]

YLimMode = auto

YMinorGrid = off

YMinorTick = off

YScale = linear

YTick = [-2 -1 0 1 2]

YTickLabel =

-2

-1

YTickLabelMode = auto

YTickMode = auto

ZColor = [0 0 0]

ZDir = normal

ZGrid = on

ZLabel = [178.006]

ZLim = [-0.5 0.5]

ZLimMode = auto

ZMinorGrid = off

ZMinorTick = off

ZScale = linear

ZTick = [-0.5 0 0.5]

ZTickLabel =

-0.5

0.5

ZTickLabelMode = auto

ZTickMode = auto

 

BeingDeleted = off

ButtonDownFcn =

Children = [174.009]

Clipping = on

CreateFcn =

DeleteFcn =

BusyAction = queue

HandleVisibility = on

HitTest = on

Interruptible = on

Parent = [1]

Selected = off

SelectionHighlight = on

Tag =

Type = axes

UIContextMenu = []

UserData = []

Visible = on

 

.

MATLAB contour, contourf contour3, . , . , , . ( , , , , , ).

, contour . , . , , ( X, Y, Z , , ).

>> [X,Y]=meshgrid(-2:0.1:2);

>> Z=-2*X.*exp(-X.^2-Y.^2);

>> colormap(gray)

>> contour(X,Y,Z)

, . 2.12.9 (, (colormap(gray)).

, , X, Y .

, , , . clabel(C,h), C, ( , , ; .. ( , , .. ), h, ( ). clabel contour, () C h:

>> [C,h]=contour(X,Y,Z);

>> clabel(C,h)

, , , . 2.12.16.

contourf

>> contourf(X,Y,Z)

(. 2.12.17), , .

contour3 (. 2.12.18).

>> contour3(X,Y,Z)

contour contour3 , , ( ). , .. .

, contour, contourf contour3,

. 2.12.15. contour.

. 2.12.16. .

. 2.12.17. contourf.

. 2.12.18. contour3.

 

('', )

.

, contour3:

>> [X,Y]=meshgrid(-2:0.1:2);

>> Z=-2*X.*exp(-X.^2-Y.^2);

>> colormap(gray)

>> [C,h]=contour3(X,Y,Z,7);

>> set(h,'LineWidth',5)

, 5 , . 2.12.19.

. 2.12.19. .

 





:


: 2016-12-06; !; : 1449 |


:

:

- - , .
==> ...

1854 - | 1814 -


© 2015-2024 lektsii.org - -

: 0.288 .