Using MATLAB (779505), страница 44

Файл №779505 Using MATLAB (Using MATLAB) 44 страницаUsing MATLAB (779505) страница 442017-12-27СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 44)

. . . . . . .Selected Bibliography......................................... 12-3. 12-3. 12-4. 12-4. 12-5. 12-5. 12-6. 12-6. 12-7. 12-8............................12-1012-1012-1112-1312-1412-1612-19. . . . 12-27. . . . . . . . . . . . . . 12-3812Polynomials and InterpolationThis chapter introduces MATLAB functions that enable you to work withpolynomials and interpolate one-, two-, and multi-dimensional data. Itincludes:PolynomialsFunctions for standard polynomial operations. Additional topics include curvefitting and partial fraction expansion.InterpolationTwo- and multi-dimensional interpolation techniques, taking into accountspeed, memory, and smoothness considerations.12-2PolynomialsPolynomialsThis section provides:• A summary of the MATLAB polynomial functions• Instructions for representing polynomials in MATLABIt also describes the MATLAB polynomial functions that:• Calculate the roots of a polynomial• Calculate the coefficients of the characteristic polynomial of a matrix• Evaluate a polynomial at a specified value• Convolve (multiply) and deconvolve (divide) polynomials• Compute the derivative of a polynomial• Fit a polynomial to a set of data• Convert between partial fraction expansion and polynomial coefficientsPolynomial Function SummaryMATLAB provides functions for standard polynomial operations, such aspolynomial roots, evaluation, and differentiation.

In addition, there arefunctions for more advanced applications, such as curve fitting and partialfraction expansion.The polynomial functions reside in the MATLAB polyfun directory.Polynomial Function SummaryFunctionDescriptionconvMultiply polynomials.deconvDivide polynomials.polyPolynomial with specified roots.polyderPolynomial derivative.polyfitPolynomial curve fitting.polyvalPolynomial evaluation.12-312Polynomials and InterpolationPolynomial Function Summary (Continued)FunctionDescriptionpolyvalmMatrix polynomial evaluation.residuePartial-fraction expansion (residues).rootsFind polynomial roots.The Symbolic Math Toolbox contains additional specialized support forpolynomial operations.Representing PolynomialsMATLAB represents polynomials as row vectors containing coefficientsordered by descending powers. For example, consider the equation3p ( x ) = x – 2x – 5This is the celebrated example Wallis used when he first represented Newton’smethod to the French Academy.

To enter this polynomial into MATLAB, usep = [1 0 -2 -5];Polynomial RootsThe roots function calculates the roots of a polynomial.r = roots(p)r =2.0946-1.0473 +-1.0473 -1.1359i1.1359iBy convention, MATLAB stores roots in column vectors. The function polyreturns to the polynomial coefficients.p2 = poly(r)p2 =112-48.8818e-16-2-5Polynomialspoly and roots are inverse functions, up to ordering, scaling, and roundofferror.Characteristic PolynomialsThe poly function also computes the coefficients of the characteristicpolynomial of a matrix.A = [1.2 3 -0.9; 5 1.75 6; 9 0 1];poly(A)ans =1.0000-3.9500-1.8500-163.2750The roots of this polynomial, computed with roots, are the characteristic roots,or eigenvalues, of the matrix A.

(Use eig to compute the eigenvalues of a matrixdirectly.)Polynomial EvaluationThe polyval function evaluates a polynomial at a specified value. To evaluatep at s = 5, usepolyval(p,5)ans =110It is also possible to evaluate a polynomial in a matrix sense. In this case33p ( s ) = x – 2x – 5 becomes p ( X ) = X – 2X – 5I , where X is a squarematrix and I is the identity matrix. For example, create a square matrix X andevaluate the polynomial p at X.X = [2 4 5; -1 0 3; 7 1 5];Y = polyvalm(p,X)Y =3771114901798125343913663912-512Polynomials and InterpolationConvolution and DeconvolutionPolynomial multiplication and division correspond to the operationsconvolution and deconvolution. The functions conv and deconv implementthese operations.22Consider the polynomials a ( s ) = s + 2s + 3 and b ( s ) = 4s + 5s + 6 . Tocompute their product,a = [1 2 3]; b = [4 5 6];c = conv(a,b)c =413282718Use deconvolution to divide a ( s ) back out of the product.[q,r] = deconv(c,a)q =456000r =00Polynomial DerivativesThe polyder function computes the derivative of any polynomial.

To obtain thederivative of the polynomial p = [1 0 -2 -5],q = polyder(p)q =30-2polyder also computes the derivative of the product or quotient of twopolynomials. For example, create two polynomials a and b.a = [1 3 5];b = [2 4 6];Calculate the derivative of the product a*b by calling polyder with a singleoutput argument.12-6Polynomialsc = polyder(a,b)c =8305638Calculate the derivative of the quotient a/b by calling polyder with two outputarguments.[q,d] = polyder(a,b)q =-2-8-241640d =4836q/d is the result of the operation.Polynomial Curve Fittingpolyfit finds the coefficients of a polynomial that fits a set of data in aleast-squares sense.p = polyfit(x,y,n)x and y are vectors containing the x and y data to be fitted, and n is the orderof the polynomial to return. For example, consider the x-y test data.x = [1 2 3 4 5]; y = [5.5 43.1 128 290.7 498.4];A third order polynomial that approximately fits the data isp = polyfit(x,y,3)p =-0.191731.5821-60.326235.3400Compute the values of the polyfit estimate over a finer range, and plot theestimate over the real data values for comparison.x2 = 1:.1:5;y2 = polyval(p,x2);plot(x,y,'o',x2,y2)grid on12-712Polynomials and Interpolation50045040035030025020015010050011.522.533.544.55To use these functions in an application example, see the “Data Analysis andStatistics” chapter.Partial Fraction Expansionresidue finds the partial fraction expansion of the ratio of two polynomials.This is particularly useful for applications that represent systems in transferfunction form.

For polynomials b and a, if there are no multiple roots,r1rnr2b(s)----------- = --------------- + --------------- + … + --------------- + k sa(s)s – p1 s – p2s – pnwhere r is a column vector of residues, p is a column vector of pole locations,and k is a row vector of direct terms. Consider the transfer function– 4s + 8---------------------------2s + 6s + 812-8Polynomialsb = [-4 8];a = [1 6 8];[r,p,k] = residue(b,a)r =-128p =-4-2k =[]Given three input arguments (r, p, and k), residue converts back to polynomialform.[b2,a2] = residue(r,p,k)b2 =-48a2 =16812-912Polynomials and InterpolationInterpolationInterpolation is a process for estimating values that lie between known datapoints.

It has important applications in areas such as signal and imageprocessing.This section:• Provides a summary of the MATLAB interpolation functions• Discusses one-dimensional interpolation• Discusses two-dimensional interpolation• Uses an example to compare nearest neighbor, bilinear, and bicubicinterpolation methods• Discusses interpolation of multidimensional data• Discusses triangulation and interpolation of scattered dataInterpolation Function SummaryMATLAB provides a number of interpolation techniques that let you balancethe smoothness of the data fit with speed of execution and memory usage.The interpolation functions reside in the MATLAB polyfun directory.Interpolation Function Summary12-10FunctionDescriptiongriddataData gridding and surface fitting.griddata3Data gridding and hypersurface fitting forthree-dimensional data.griddatanData gridding and hypersurface fitting (dimension >= 3).interp1One-dimensional interpolation (table lookup).interp2Two-dimensional interpolation (table lookup).interp3Three-dimensional interpolation (table lookup).interpftOne-dimensional interpolation using FFT method.InterpolationInterpolation Function Summary (Continued)FunctionDescriptioninterpnN-D interpolation (table lookup).mkppMake a piecewise polynomialpchipPiecewise Cubic Hermite Interpolating Polynomial(PCHIP).ppvalPiecewise polynomial evaluationsplineCubic spline data interpolationunmkppPiecewise polynomial detailsOne-Dimensional InterpolationThere are two kinds of one-dimensional interpolation in MATLAB:• Polynomial interpolation• FFT-based interpolationPolynomial InterpolationThe function interp1 performs one-dimensional interpolation, an importantoperation for data analysis and curve fitting.

This function uses polynomialtechniques, fitting the supplied data with polynomial functions between datapoints and evaluating the appropriate function at the desired interpolationpoints. Its most general form isyi = interp1(x,y,xi,method)y is a vector containing the values of a function, and x is a vector of the samelength containing the points for which the values in y are given. xi is a vectorcontaining the points at which to interpolate. method is an optional stringspecifying an interpolation method:• Nearest neighbor interpolation (method = 'nearest').

This method sets thevalue of an interpolated point to the value of the nearest existing data point.• Linear interpolation (method = 'linear'). This method fits a different linearfunction between each pair of existing data points, and returns the value of12-1112Polynomials and Interpolationthe relevant function at the points specified by xi. This is the default methodfor the interp1 function.• Cubic spline interpolation (method = 'spline'). This method fits a differentcubic function between each pair of existing data points, and uses the splinefunction to perform cubic spline interpolation at the data points.• Cubic interpolation (method = 'pchip' or 'cubic'). These methods areidentical. They use the pchip function to perform piecewise cubic Hermiteinterpolation within the vectors x and y. These methods preservemonotonicity and the shape of the data.If any element of xi is outside the interval spanned by x, the specifiedinterpolation method is used for extrapolation.

Характеристики

Тип файла
PDF-файл
Размер
6,57 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7020
Авторов
на СтудИзбе
261
Средний доход
с одного платного файла
Обучение Подробнее
{user_main_secret_data}