You are on page 1of 31
UNIT 3 INTERPOLASI 1 TUTUAN PRAKTIKUM TTujuan dari pabdibam vast % wi yoile bk Mewahanmi bepbams: bent inkrpolasi 2 Mematami penvlisan inkrpotasi dalam MATIAG 3. Memahani dan manpy tenbuat aplitasi dengan erpotesi 2-HASIL PENGAMATAN DAN ANALISIS 21 Program | “rdewerate the Paks function at (OW repruton. [rc] dan (0Berdarartan pecedaan can oulpul grefilc Yors dictepat pede program 1, dapat Alan LEIS bahwde DoY]= meshand (2.0.12) yrctu UME venentutan madris HebfOr © Ye dengan Grge -2éx02 dan -2242 dengan Fenaitan wabits yektor seberar on. Kemoian, untuk mencntotan paiak fda due vanabet yar mengiusilecn dimenit degen penitcl RAH (04) Yang Leto Foren any, Seuagatnys, uniuk nenamuptiten atch 40 mengguuaten Penuatels sure (yr). Kenupion Dew anauiiny Hates, bepmwPuLen Urn Aapak Rawbit youu: Mesagard barre anivt wenentuten puncek fade dv vericdel dan SUF Oey) MAE emreneupitesn flot metres 2 didi fetinyaian bidany xy femedtan best YARIS Youn ditampilten burps 30, 2. Coambar kerdepat dimuimeke bio To6As ay =) Berdatattan YEAk yang cesuei dengen penuiten multi dimensions gndding yariu value menenturan fep Fordinat HAK dengcn kt 2-2-0: 2:27 Xr=-2:0.16:2 - dan RSs 2:0 62. Sdanguiny, penntch Yon Rigueaten Yorty Teuxr¥a}endgad (xm xe); diwane pennéch ndGrid” Yoaty obduy menampilten Output 1D Pade furuncn| x14 dom Pethitngen mulhdimensivnet daw inlerpoies Ade Bags funy Ss 47 yaide EKA Oe Lx Na axe “2 18.2); bimane ext Yeotl OFONLMS1. Dan uhtve mrenareprt- KAD gagit (rian Weedinak x4 fade Lhe Petuny C02 ow 2) den C2 ©) yaaty mengnuncten Perinteh Sie (v2, x.X8,/2eL4& OF 23, 2/02 ony. Ketruguicn Den anougs Kotes, dower drawbar Regupucan yates Unive menardiltan api (0, yang ALakLEER Yecty kordinal nig, Femubian funy” nda rid! barton enue Arce Astin pulubuanen fervor} Dan Fuge, udepct pe minfeh AUMIG une Menaiupitten SIShk Lagan Ae KKK Fotom, menentuken | Scanned with CamScanner Scanned with CamScanner g 5 8 8 £ & oO s = 3 3 £ & 8 no Scanned with CamScanner Done Show DataCursor [J Figure 1: surf (x,y,z) Scanned with CamScanner Done Show Data Cursor [J Figure 1: surf (xiyi,zi1) Scanned with CamScanner Done Show Data Cursor &) Figure 1: surf(xi,yi,zi2) Scanned with CamScanner Done Show DataCursor Figure 1: surf(xi,yi,zi3) Scanned with CamScanner Figure 1: slice(X2,X1,X3,z,[-1.2 0.8 2],2,[-2 0.2]) Scanned with CamScanner >> egrafik fungsi dua variabel >> [xyyl=meshgrid( 1:4); aesqrt(x.%24y."2); p> mesh(x,y,2) ¥ >> Ngrafik yang lebih menarik >> Dxsyl=meshgrid -10:10) ; b> zesqrt(x."24y.°2); >> mesh(x,y,2); >> Deyszl=peaks: >> clt >> Norafik x°24y"2 dalam berbagaisudut pandang >> plot(z) >> nesh(x.y.2) >> surflxsy.2) >> shading flat >> contour (x,y,2) >> contourf(x,y,2) >> surf (x.y.2) :grid off >> view(90,0) >> view(90,0);shading flat ~ Scanned with CamScanner >> help mesh; mesh 3-D mesh surface. mesh(X,Y,Z,C) plots the colored parametric mesh defined by four matrix arguments. The view point is specified by VIEW. The axis labels are determined by the range of X, Y and Z, or by the current setting of AXIS. The color scaling is determined by the range of C, or by the current setting of CAXIS. The scaled color values are used as indices into the current COLORMAP. mesh(X,Y,Z) uses C = Z, so color is proportional to mesh height. mesh(x,y,Z) and mesh(x,y,Z,C), with two vector arguments replacing the first two matrix arguments, must have length(x) = n and length(y) =m where {m,n} = size(Z). In this case, the vertices of the mesh lines are the triples (x(j), y(i), Z(i,j)). Note that x corresponds to the columns of Z and y corresponds to the rows. mesh(Z) and mesh(Z,C) use x = 1:n and y = 1:m. In this case, the height, Z, is a single-valued function, defined over a geometrically rectangular grid. mesh(...,'PropertyName',PropertyValue,...) sets the value of the specified surface property. Multiple property values can be set with a single statement. mesh(AX,...) plots into AX instead of GCA. mesh returns a handle to a surface plot object. AXIS, CAXIS, COLORMAP, HOLD, SHADING, HIDDEN and VIEW set figure, axes, and surface properties which affect the display of the mesh. See also surf, meshc, meshz, waterfall. Documentation for mesh Scanned with CamScanner >> help peaks; peaks A sample function of two variables. peaks is a function of two variables, obtained by translating and scaling Gaussian distributions, which is useful for demonstrating MESH, SURF, PCOLOR, CONTOUR, etc. There are several variants of the calling sequence: peaks; = peaks(N); peaks (V); peaks (X,Y); NNNN peaks; peaks(N); peaks(V) ; peaks (X,Y) ; (X%Y,Z] [%Y,Z] (GY,Z] = peaks; peaks(N); peaks(V); The first variant produces a 49-by-49 matrix. The second variant produces an N-by-N matrix, The third variant produces an N-by-N matrix where N = length(V). The fourth variant evaluates the function at the given X and Y, which must be the same size. The resulting Z is also that size. The next four variants, with no output arguments, do a SURF plot of the result. The last three variants also produce two matrices, X and Y, for use in commands such as PCOLOR(X,Y,Z) or SURF(X,Y,Z,DEL2(Z)). If not given as input, the underlying matrices X and Y are [X,Y] = MESHGRID(V,V) where V is a given vector, or V is a vector of length N with elements equally spaced from -3 to 3. If no input argument is given, the default N is 49. Documentation for peaks Scanned with CamScanner >> help clf; clf Clear current figure. clf deletes all children of the current figure with visible handles. clf RESET deletes all children (including ones with hidden handles) and also resets all figure properties, except Position, Units, PaperPosition and PaperUnits, to their default values. clf(FIG) or cl#(FIG, 'RESET') clears the single figure with handle FIG. FIG_H = clf(...) returns the handle of the figure. See also cla, reset, hold. Documentation for clf Scanned with CamScanner >> help plot, plot Linear plot plot(x,¥) plots vector ¥ versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or colunns of the matrix, whichever line up. If X is a scalar and Y is a vector, disconnected Line objects are created and plotted as discrete points vertically at Xi plot(Y) plots the columns of Y versus their index. If Y is complex, plot(Y) is equivalent to plot(real(Y),imag(¥)). In all other uses of plot, the imaginary part is ignored. Various Line types, plot symbols and colors may be obtained with plot(x,Y,S) where $ is a character string made from one elenent from any or all the following 3 columns: b blue + point solid 9 green o circle dotted ro Fed x xenark dashdot © cyan + plus 2 dashed magenta a (none) no Line y yellow s square k black d— dianond W white v triangle (down) triangle (up) < triangle (Left) > triangle (right) P pentagram h hexagram For example, plot (X,Y, 'c#:") plots a cyan dotted Line with a plus at each data point; plot (X,¥,'bd') plots blue dianond at each data point but does not draw any line: plot (x1, 1,51, X2, ¥2,52,X3,Y3,53,...) combines the plots defined by the (X,Y,5) triples, where the X's and Y's are vectors or matrices and the $s are strings. For example, plot (X,Y, "y-".X,Y,'go") plots the data twice, with a solid yellow Line interpolating green circles at the data points The plot command, if no color is specified, makes automatic use of the colors specified by the axes ColorOrder property. By default, plot cycles through the colors in the ColorOrder property. For monochrome systems, plot cycles over the axes LineStyleOrder property. Note that RGB colors in the ColorOrder property may differ from similarly-naned colors in the (X,Y,S) triples. For example, the second axes ColorOrder property is’nediun green with RGB [0.5 0], while plot(X,Y,'g") plots a green Line with RGB [0 1 0} If you do not specify a marker type, plot uses no marker. If you do not specify a line style, plot uses a solid Line plot(AX,...] plots into the axes with handle AX. plot returns a colunn vector of handles to Lineseries objects, one handle per plotted Line. The X,Y pairs, or X,¥,S triples, can be followed by paraneter/value pairs to specify additional properties of the Lines. For example, plot (X,Y, ‘LineWidth",2,‘Color",[.6 @ ]) Will create a plot with a dark red line width of 2 points. Example X= -pi:pi/10:pi; y = tan(sin(x)) = sin(tan(x)); plot(x,y,'--rs', 'Linewidth’ 2, ‘WarkerEdgeCotor’ ‘MarkerFaceColor’ |g", ‘MarkerSize' , 10) See also plottools, semilogx, semilogy, loglog, plotyy, plot3, grid, title, xlabel, ylabel, axis, ‘axes, hold, legend, subplot, scatter. Documentation for plot Other functions named plot Scanned with CamScanner >> help surf; surf 3-D colored surface. surf(X,Y,Z,C) plots the colored parametric surface defined by four matrix arguments. The view point is specified by VIEW. The axis labels are determined by the range of X, Y and Z, or by the current setting of AXIS. The color scaling is determined by the range of C, or by the current setting of CAXIS. The scaled color values are used as indices into the current COLORMAP. The shading model is set by SHADING. surf(X,Y,Z) uses C = Z, so color is proportional to surface height. surf(x,y,Z) and surf(x,y,Z,C), with two vector arguments replacing the first two matrix arguments, must have length(x) = n and length(y) = m where [m,n] = size(Z). In this case, the vertices of the surface patches are the triples (x(j), y(i), Z(i,j)). Note that x corresponds to the columns of Z and y corresponds to the rows. surf(Z) and surf(Z,C) use x = 1:n and y = 1:m. In this case, the height, Z, is a single-valued function, defined over a geometrically rectangular grid. surf(...,'PropertyName' ,PropertyValue,...) sets the value of the surface property. Multiple property values can be set with a single statement surf(AX,...) plots into AX instead of GCA. surf returns a handle to a surface plot object. AXIS, CAXIS, COLORMAP, HOLD, SHADING and VIEW set figure, axes, and surface properties which affect the display of the surface. See also surfc, surfl, mesh, shading. Documentation for surf >> Enter command here.. Scanned with CamScanner Done Show Data Cursor [7] Figure 1: mesh(x,,2); Scanned with CamScanner Done Show Data Cursor [) Figure 1: mesh(x,y,z); Scanned with CamScanner Done Show DataCursor [) Figure 1: cif Scanned with CamScanner Done Show Data Cursor [A Figure 1: plot(z) 10 : T 1 1 0 10 20 30 40 50 Scanned with CamScanner Done Show Data Cursor [7 Figure 1: mesh(x,y,z) 10 fi y \ AN A HN i iH HAKY \ 5 -10 Scanned with CamScanner Done Show Data Cursor [HJ Figure 1: surf(x,y,z) Scanned with CamScanner Done Show DataCursor [A Figure 1: shading flat Scanned with CamScanner Done Show Data Cursor [) Figure 1: contour(x,y,z) 2 Scanned with CamScanner Figure 1: contourf (x,y,z) Scanned with CamScanner Done Show DataCursor [) Figure 1: surf(x,y,z);grid off Scanned with CamScanner Done Show Data Cursor [ Figure 1: view(90,0) 10 Scanned with CamScanner Done Show DataCursor ff Figure 1: view(90,0);shading flat 10, Scanned with CamScanner

You might also like