Crtanje i kombinovanje grafova

Show[plot]     -   ponovo nacrtaj graf Show[plot, optionvalue ... afova Show[GraphicsArray[ { {plot1, plot2, ...}, ... }]]     - nacrtaj niz grafova

In[1]:=

Plot[ChebyshevT[7, x], {x, -1, 1}]

[Graphics:HTMLFiles/Predavanje-6_3.gif]

Out[1]=

⁃Graphics⁃

In[2]:=

Show[%]

[Graphics:HTMLFiles/Predavanje-6_6.gif]

Out[2]=

⁃Graphics⁃

In[3]:=

Show[%, PlotRange {-1, 2}]

[Graphics:HTMLFiles/Predavanje-6_9.gif]

Out[3]=

⁃Graphics⁃

In[4]:=

Show[%, PlotLabel"Chebyshevljev polinom"]

[Graphics:HTMLFiles/Predavanje-6_12.gif]

Out[4]=

⁃Graphics⁃

Možemo korisiti Show kako bismo kombinovali nekoliko grafova

In[5]:=

gy0 = Plot[BesselJ[0, x], {x, 0, 10}]

[Graphics:HTMLFiles/Predavanje-6_16.gif]

Out[5]=

⁃Graphics⁃

In[6]:=

gy1 = gj0 = Plot[BesselY[1, x], {x, 1, 10}]

[Graphics:HTMLFiles/Predavanje-6_19.gif]

Out[6]=

⁃Graphics⁃

In[7]:=

gjy = Show[gy0, gy1]

[Graphics:HTMLFiles/Predavanje-6_22.gif]

Out[7]=

⁃Graphics⁃

Primjetite da se odnos izmedju dva grafa podesi

In[8]:=

Show[GraphicsArray[{{gy0, gjy}, {gy1, gjy}}]]

[Graphics:HTMLFiles/Predavanje-6_26.gif]

Out[8]=

⁃GraphicsArray⁃

In[9]:=

Show[%, FrameTrue, FrameTicksNone]

[Graphics:HTMLFiles/Predavanje-6_29.gif]

Out[9]=

⁃GraphicsArray⁃

Ovo je nacin kako promjeniti opcije za sve plotove u nizu

In[10]:=

Show[% /.(TicksAutomatic)  (TicksNone)]

[Graphics:HTMLFiles/Predavanje-6_33.gif]

Out[10]=

⁃GraphicsArray⁃

In[11]:=

Plot[Cos[x], {x, -Pi, Pi}]

[Graphics:HTMLFiles/Predavanje-6_36.gif]

Out[11]=

⁃Graphics⁃

In[13]:=

RowBox[{Show, [, RowBox[{%, ,, RowBox[{PlotRange, , RowBox[{{, RowBox[{RowBox[{{, RowBox[{0, ,, 0.3}], }}], ,, RowBox[{{, RowBox[{0.92, ,, 1}], }}]}], }}]}]}], ]}]

[Graphics:HTMLFiles/Predavanje-6_39.gif]

Out[13]=

⁃Graphics⁃

Trodimenzionalni površinski grafovi

Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}]         &n ... nbsp;     pravi trodimenzionalnu graf f kao funkcije promjenljivih x i y

In[14]:=

Plot3D[Sin[x * y], {x, 0, 3}, {y, 0, 3}]

[Graphics:HTMLFiles/Predavanje-6_43.gif]

Out[14]=

⁃SurfaceGraphics⁃

Postoje mnoge opcije za trodimenzionalne grafove u Mathematici . Neke cemo raspraviti na ovom predavanju, druge nesto kasnije

Axes                ...             - da li kompajlirati funkciju

In[15]:=

RowBox[{Show, [, RowBox[{%, ,, RowBox[{PlotRange, , RowBox[{{, RowBox[{RowBox[{-, 0.5}], ,, 0.5}], }}]}]}], ]}]

[Graphics:HTMLFiles/Predavanje-6_48.gif]

Out[15]=

⁃SurfaceGraphics⁃

RowBox[{Sa gornjim postavkama, ,,  , RowBox[{RowBox[{samo dio grafa u,  , -, 0.5}], <, z, <, RowBox[{0.5,  , je,  , prikazan}]}]}]

In[16]:=

Plot3D[10 Sin[x + Sin[y]], {x, -10, 10}, {y, -10, 10}, PlotPoints50]

[Graphics:HTMLFiles/Predavanje-6_52.gif]

Out[16]=

⁃SurfaceGraphics⁃

In[17]:=

Show[%, AxesLabel {"Vrijeme", "Dubina", "Vrijednost"}, FaceGridsAll]

[Graphics:HTMLFiles/Predavanje-6_55.gif]

Out[17]=

⁃SurfaceGraphics⁃

In[18]:=

Plot3D[Sin[x * y], {x, 0, 3}, {y, 0, 3}]

[Graphics:HTMLFiles/Predavanje-6_58.gif]

Out[18]=

⁃SurfaceGraphics⁃

In[19]:=

Show[%, ViewPoint {0, -2, 0}]

[Graphics:HTMLFiles/Predavanje-6_61.gif]

Out[19]=

⁃SurfaceGraphics⁃

Neke tacke pogleda

{0, -2, 0 }     - direktno sprijeda {0, -2, 2}      - sprij ...  -2, 0}     - desni  ugao {0, 0, 2}     - direktno odozgo

In[20]:=

g = Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}]

[Graphics:HTMLFiles/Predavanje-6_66.gif]

Out[20]=

⁃SurfaceGraphics⁃

In[21]:=

Show[g, MeshFalse]

[Graphics:HTMLFiles/Predavanje-6_70.gif]

Out[21]=

⁃SurfaceGraphics⁃

In[22]:=

Show[g, ShadingFalse]

[Graphics:HTMLFiles/Predavanje-6_74.gif]

Out[22]=

⁃SurfaceGraphics⁃

In[23]:=

Show[g, LightingFalse]

[Graphics:HTMLFiles/Predavanje-6_77.gif]

Out[23]=

⁃SurfaceGraphics⁃

List grafovi

ListPlot[{y1, y2, ... .}]      - nacrtaj y1, y2, ... u vrijednostima x 1, 2, ...

ListPlot[{ {x1, y1}, {x2, y2}, ... }]     - nacrtaj (x1, y1), ...

ListPlot[list, PlotJoinedTrue]    - povezi tacke

ListPlot3D[{z11, z12, ...}, {z21, z22, ...}]     - nacrtaj trodimenzionalni graf niza visina z_yx

In[25]:=

t = Table[i^2, {i, 10}]

Out[25]=

{1, 4, 9, 16, 25, 36, 49, 64, 81, 100}

In[26]:=

ListPlot[t]

[Graphics:HTMLFiles/Predavanje-6_86.gif]

Out[26]=

⁃Graphics⁃

In[27]:=

ListPlot[t, PlotJoinedTrue]

[Graphics:HTMLFiles/Predavanje-6_89.gif]

Out[27]=

⁃Graphics⁃

In[28]:=

Table[{i^2, 4 i^2 + i^3}, {i, 10}]

Out[28]=

{{1, 5}, {4, 24}, {9, 63}, {16, 128}, {25, 225}, {36, 360}, {49, 539}, {64, 768}, {81, 1053}, {100, 1400}}

In[29]:=

ListPlot[%]

[Graphics:HTMLFiles/Predavanje-6_94.gif]

Out[29]=

⁃Graphics⁃

In[30]:=

t3 = Table[Mod[x, y], {y, 20}, {x, 30}] ;

In[31]:=

ListPlot3D[t3]

[Graphics:HTMLFiles/Predavanje-6_98.gif]

Out[31]=

⁃SurfaceGraphics⁃

In[32]:=

RowBox[{Show, [, RowBox[{%, ,, RowBox[{ViewPoint, , RowBox[{{, RowBox[{1.5, ,, 0.5, ,, 0}], }}]}]}], ]}]

[Graphics:HTMLFiles/Predavanje-6_101.gif]

Out[32]=

⁃SurfaceGraphics⁃

Parametarski Grafovi

ParametricPlot[{fx, fy}, {t, tmin, tmax}]     - nacrtaj parametarski graf

ParametricPlot[{{fx, fy}, {gx, gy}, ...}, {t, tmin, tmax}]     - nekoliko grafova zajedno

ParametricPlot[{fx, fy}, {t, tmin, tmax}, AspectRatioAutomatic]     - pokusaj sacuvati oblik krivih

In[33]:=

ParametricPlot[{Sin[t], Sin[2t]}, {t, 0, 2Pi}]

[Graphics:HTMLFiles/Predavanje-6_107.gif]

Out[33]=

⁃Graphics⁃

In[34]:=

ParametricPlot[{Sin[t], Cos[t]}, {t, 0, 2Pi}]

[Graphics:HTMLFiles/Predavanje-6_110.gif]

Out[34]=

⁃Graphics⁃

In[35]:=

Show[%, AspectRatioAutomatic]

[Graphics:HTMLFiles/Predavanje-6_113.gif]

Out[35]=

⁃Graphics⁃

ParametricPlot3D[{fx, fy, fz}, {t, tmin, tmax}]     - nacrtaj parametarski graf trodimenzionalne krive

ParametricPlot3D[{fx, fy, fz}, {t, tmin, tmax}, {u, tmin, tmax}]    - nacrtaj parametarski graf trodimenzionalne povrsi  

ParametricPlot3D[{fx, fy, fz, s} ...]    - osjenci dijelove parametarskog grafa po funkciji s

ParametricPlot3D[{{fx, fy, fz}, {gx, gy, gz}, ...} ...] - nekoliko objekta zajedno

In[36]:=

ParametricPlot3D[{Sin[t], Cos[t], t/3}, {t, 0, 15}]

[Graphics:HTMLFiles/Predavanje-6_120.gif]

Out[36]=

⁃Graphics3D⁃

Slika kruznog heliksa

In[38]:=

ParametricPlot3D[{t, u, Sin[t * u]}, {t, 0, 3}, {u, 0, 3}]

[Graphics:HTMLFiles/Predavanje-6_124.gif]

Out[38]=

⁃Graphics3D⁃

In[39]:=

ParametricPlot3D[{t, u^2, Sin[t * u]}, {t, 0, 3}, {u, 0, 3}]

[Graphics:HTMLFiles/Predavanje-6_127.gif]

Out[39]=

⁃Graphics3D⁃

Ovo je gornja povrs gdje je y koordinata promjenjena kvadratnom transformacijom

In[40]:=

ParametricPlot3D[{u Sin[t], u Cos[t], t/3}, {t, 0, 15}, {u, -1, 1}]

[Graphics:HTMLFiles/Predavanje-6_131.gif]

Out[40]=

⁃Graphics3D⁃


Created by Mathematica  (November 28, 2007)