0% found this document useful (0 votes)
72 views

MATLAB Unit 4 Part 1

matlab unit 4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
72 views

MATLAB Unit 4 Part 1

matlab unit 4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 25
UNITS Te Non-Linear €auiations; A non-Linesy equation ts defined 8S, he Eauation having the ‘maxieum degree 2 or move than 2. TUS Sprescad In the. general form as: Hee ab5¢ ate. conttort values and ay are Variables » —Anon- Linear Equation Jacke dike a curve ta 2 Graph. “This eqyation will have 2 variable Slope. Value — Sxombesi(y Pry @) aarnmytyr= (@ C4742 2 28. on agrth, Ton-dinear éausations can take. many shapes (rom simple curves to elaborate figues) ° CD Polumenfal of lagna Nt = These Cations ill have quadratic, cubic quartic cueantic or higher ederterms Terms invwelvng porere ep XD Ex4 x5 ete. tb Radics! or Rahional exponent : — "hese euatins have tems with vavintles that have exponents = eg. terms dice x7 x28 8 ete Cid RaHonal function + = Theteteustions rill have, factions sith Polunaniials Th the. wumerator Snel enema 8% Tems dike ty 1 tS te, Mos GD Exponential ; hese Equations will have terms whth a constant base and a Yartabe th “the -Cxpment — 6 Tens ke 2%, (Wy Lofarithmic: — These Gauintions have Tens kith a lajarithm . = 29; Terms Suh a8, 10230, [05,9l42) Sey ipa, and tangent, cmpene Bvuations ‘it have tewe, with sine cost = 29; sink), Ces(2X) TanlO tev x ions ave alto Kraan as Note jug. tinea aigebreie Equations a polynomial eaustors Polynomial £0 -dau.ations tn ete ot more: Variables, me hot contain atleast one Susation thet 1S Net Linear, “wen cegtah stem othe ogaterm Rateg Naked en £7 grt io he aed _ MaTLAa has 2 fincton ,“fzero! —_ eolving fayationg With one variable. MATLAB & solver’ | : Tah WATUA®, Sohev8. are. provides for nonlinear alebrate eamations. Toollaen” these solers ave. avaliable in the Optimizat The Marine methods (sais) ave usec! To Kh =feerot erp) 212! 0:4) ihe Fanarion 15 arto ae xe Shing expession | o-as02 R= QUO MerR Mn0:2 Basin ae eure bean) r SOOM EXPH 0.2 | o> raeotene) —.: 2 (The eecond sohaim Te SSE =the feero Command Ande teres a a function only Where the function cvosses the axis, The Geer command ty alo Wied to find the value pC, Where, the furctim hes a specific value. peeve) fzer command additional opti ~The feero Command has adittonsl option . © =the ofthe. trportant options are : p [De Fall = feroginerion x0) | Tihis will aston the Value athe funeion atx te the Variable cn no arise isplaya ‘the output C} €ach Trerstin dning the Process of Gin, ding the Solution, - Ws = a os ts oy es eS om | solleg non-Jinear equations with mullite variables: = SEIS the built-in finetion , 40 Soke. Sets of non—dinear al gebrate Eauations . 145 synteis, [Bshe(xa) Sk, coder the tt Seen roams asig bee xitaies + t Ls, at my -Bm 2 a $20 onder 10 Soke the above Sytem op éetuating Ne re nite @ as, a) = Pa arhsm ota Fe) = wrantsno sy fi Ct,%a) = 227% 2%, 3x, -2: S70 The shove Systten op EAuotions represented. ey) me Ma) Converteck foto MATLAB Funcnione « ~Pefine Ws as on Mfile Say fi dB2.m : ~The mains code for@ Ean is as folls ‘Faretion-toofeecton ee) | function Y= emntotpees%: | Yio = xio*xcn +4 astkag-s Nea) = 2%et1o e145 29K - aetay 2 ~ Now, Ne Npe the following statements ft he MATLAB command window, SO ATnitial quess [8 021] >? X-Fedkve CIF c2! X0, optim Pestvey ast X= 2.000 o.8000 ° r “£9: solve. the. following system aj.nan—linesr gqustions using MATLAB, we Feta = % 420 ae, ACh) = 2 Pe Bete EB system op non—Line>r equatims ts aiven by, $00, 22) = %) 47 Xe . 2D Falta) DE-Mye— ar, forthe lave itn op Gouna repsentec te D, We We'te an Mm. J Pimetion + lewd Fit) = RCL) ~ 4K 2 = REI *KOD? Fla) = 2829-02) 92 4 3°K(4) ax (09 whe swe this File as = Enter the tnilial guess Het ta > Winipose: Sf 2 9 Veet = Now, Sates, Eero stian: “Tiferpolahiony 1S the. estimation Yvelues beeen data points. — Feterpoletion produces a function that marches “he Jiven data. Sractly — The * standard -Brms of Interpolation forthe pdynemial avet db Lagrende Interpolation and Gi Neston taterpolation.. MATLAB Povides ‘the folloning fimctions to parfixm interpobtion « They ae Co interes civ intevp2 citi) tnteres Ci spline. and (va Interpft . Legiange Imterpottian: = The. Lagenge frm othe @usation of the. porskols pasaing | through “three Pointe Gai) 4) ar Cat) #5, 4 pnGetOl 8) uy | 9 taxa ee 4) Cae), = The. generat fom a a. phono push weagh dab pomte Ga eat, | ae = 3-0. = For the expression representes by © Numeroter 1 denoied by, WO = CLAY (Mer) (Le MD a CMY ALE benenfnasr, Del) = (Mer BJ (a Bt) (ie Rigs) C=) expressed 3s, sm Fenty rein —Herelin Em@) NM NE. hin we collet Mumeraiors , = Here Gr €om @) Cy, 2,63 ---- en are Caled Logronge coefficients wthey ore 17 dover refracted 95, LesrangeCaeheOnr) lengmn(d: Ri ddd = AO NCO0) — 059) end eed = Yeh) + end end CRELCEPLLLILLLPRS PL, CAMATLAR Program for avalusting) Legenge: palynemiat Punciion |p = Lagrangebvalle%<) \ lengthOo): 41 length) EGge Plynanin ott. wes §y 2 NED * (beta — x00) + Rds PENCE) # eC): and = Find the autaderic Palynomiaal Using the three. Siven points COD = G24) Ga 49 2 Ce2) (a4 = G2) Bi the gerem| formula -fir Finding Ladrenés Bauation the. Parskole fs given by, Cm) Cems) 2 Goer Cun) Cement) pls Gere oem) coe op CME) ai ta Cama Canora Yt Gantry 8 Subalihng’ 3-15, My Ah Ns Values In the above Parc. @nionin (tod OGD 9 CRICO ey (A)@) 2 Cer(e4a) ce = pos ca) + 22 tay 4 EO 2) + Genoeeny tay )_gayt poe UD 4 epee 4 CO) we ntlenn) ~ (43) (0-2) 4 260 tate) 2 ou ~ (A) CRI) —— Z vy oa -xte a + 2 eae ees x 3» oxthaned | =e morpetation ~Typest nperereren epee 4) one climensimal data interpolation. ) HO-—dimensional data interpolation, Ip theee.—dimensiona|_ interpolation. | Cit) date interpol taberpL 3 one -clivensional (4-6) 5 Interpolation . 'U' depends on a angle Variable. aa one-dimensional data Interpolation, xs ghen yr at x7 usng the function, Jus = #C%5)] ve find yy ar desled 25 = Here “plis 3 Conbhucus function that is fund from interpolation, = Suntox: [yew = taterrtQuy, new, etna) Fa the abore Syntax, tnfeypL tsa funchon Used to peform one -dimension2| Tater polation. ~ Here, method is an optional argument, eine] : = HS a one -dimensionz! Interpolation, 26 used fo fing iat desind — tt uses cubic splines , xy bic Splines ore used to fit seperate cubic polunamials “between successive date points , = Seta: ethody ere . : ~ PS a fast — fourier mansforn eet) besed 4-D data interpelation. AC -AYSE the data fs Interpolated using FFT. Newb the: Inverse trantfom ts calculated using more deta polts, — THis Wierpotaticn ta especially used for pertode. tumtione, pling 4, x [rev Thos dimensional interpol — The General fier Ger he desired curve fit and other displays 1 Such as “the fitted fquistions. aon inne Figure Felav (erage _qHs obtsined os SI Pee RRALEE VEL TEL aS ea! pipe Aincar cure and dspey the éuration: c check {HF the boxes for _Linea® and Show eausstions”/ from ‘the Basic. Fitting windon options, -we ore nen dene. athe result fs Shown tn the figure below Bears gz uwe Fiing using bullet — ILt-In Function: nt = Lt he = rs felave! eae pole A 2) polynomials: —pdynomials are functions: that we os anXat Bon Sehetas | a 21,20 are real he coefhicientk an, An Here, 1 snumsers + —Beomeles: Exomples of Polynomials are ae es polynomial oy eater 5 FOO = 2204 HO — polynemisl oy deates ? fen = Were - polynomial! ay aegreet. nomial with degree 0 yee ape are wepresented by aon vector _ a constants, Fe the: coefficients Marta, polynomials =m — the Elements % Tis won vector ave : an, ante 34,30" Year inciudes =! coef lice include = The first Element js the & efficient ae nin jhe highest pokey: _folynoméel aqmine Representstion. BLS p28 sy 20 4c a- 2-414) eae. pete 0-23 Gxt 150, AT Ge? 40% - 150 Spend 5Sr eo ax, maTLAB form? hte otro! 2p OF= THO" e=oos 44 thyyalue of polureméal, Cryin — Marae, lt io Raed ihe Valug qa polgnoméal at a point 20 can be coleutated with the function in MATLAB te, Poluval | = The Geneal synh« Ge polyval function 1s 2s shen. Polyval (PD, : Oo sy —Fathe syntex, [poaicmo | PoE with Coefficient op The. polynomial. X= Number or 2 Varirble. = The Commend, We Polyvalla,*) | tvalasates the polynemal at date points x. = this commnench genemtes the values Yi such That; 4 acne tatntd te —t tee Belengtn the vectDr(Row verve) aneL. order qp the Polunemial (Dears) = 7° = par the polynomdal Fewe Beuemeaee 40" 55 a! 3 p.oset Hast 435-88 encoateutste. fL4). ib plot The: polynomts| for salt Given polynontial 1s, P fans U7 Ia lets 40:51 % ay BB ne cocfiicients Op the above pokmamzel fe tpiael, 40184, — Hols, - #45 ad g516e ate pesigqned to the vector P° eis hesigned to avec 4 since fla) need to be caleutated anes ts ert: molge t= HIS ET HEE. —polyal(Px) | This function ts wed to calculate he yalue abx= 4 command Winder 8s — the problem is solved 1 the. shawn leben? Sp = Et wie 40°57 yp polyvel(P 9) ans = 4. 2644e003 Tees -#45 36°88]; + plot the pelunemia| -for 15 6x 26.5 oj Given polynomial is, Pods Paty 40:89 eF- [OIS A HASH + SEE (eS F Sap plot the Sbowe polynomial, a vector x 16 first definect. — the Elements In Vector x Yanges fram -1:3 -fo~ SF, Bho a vector Ys created With the values ap the ~ polynomial — this vector has all the values for Every Element of x , — finally, > plot yvs x is made. = The problem 7S solved inthe commend winday 3s shown below: px srs rot 16s p> y= polyval (P24 yp plobcs ¥) (©) Roots of = polynomial ; Fe —The roots of a polynomial are the values of the BrGument (2 When the Value q the _palynemial fs Goal to Zero, — Brompie: Roots op the Polynomial. Pee 24-3 are tthe values of x! when ftx) la Set to zero, p—por finding the roots qj The ahove polynonia|, find we consider % 22-2350. aeaere-aso. [> 2-3) + 1(L"3I=O = -3xi] 5 GB) (X41) =O 5 EBse CN GH=0 > x23 oD eT Herta the Yost the Polynemial FOO= a-2-3 are. or 3 A roots: function tn MATLAD MATLAB has a bulle-tn function + Yoots thet W1ll deteumine the root, or rots of a polynomtal >roots(C+ 10 -a) ans 2.1995 016335 the coefficients of the polynomial. je bullé-in MATLAB’S function. ~The General form ap poly command (sunteo is as shown: yor) vector WIth ‘the Coefficients the crv Crow or column) sim the rook oy the polynomial. Here p= polynereé=) r= Ve BS asin © co-chticients q 2 polynomial when roots are knoyn i shen the roots of a polynomial are Kner, Ly command can be wed for determining — poly is one & th Biomple che roots Of the polynemial 3 Kraan. ee CD ethey we 6, 4 BBD o ond oS _- nav, the coefficient athe. polynomial are obtained using the Sbeve roots tthe folloving © mm the Command winday tupe commands: sr=be + aha oss 7 p= polycr) 1 -l#-o1s0 ‘4.0000 -l2xto00 407540 —a1.9500 35-8800

You might also like