Matlab - Getting start, страница 5

PDF-файл Matlab - Getting start, страница 5 Цифровая обработка сигналов (ЦОС) (15294): Книга - 8 семестрMatlab - Getting start: Цифровая обработка сигналов (ЦОС) - PDF, страница 5 (15294) - СтудИзба2017-12-27СтудИзба

Описание файла

PDF-файл из архива "Matlab - Getting start", который расположен в категории "". Всё это находится в предмете "цифровая обработка сигналов (цос)" из 8 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "цифровая обработка сигналов" в общих файлах.

Просмотр PDF-файла онлайн

Текст 5 страницы из PDF

MATLAB also provides many more advancedmathematical functions, including Bessel and gamma functions. Most of thesefunctions accept complex arguments. For a list of the elementary mathematicalfunctions, typehelp elfunFor a list of more advanced mathematical and matrix functions, typehelp specfunhelp elmat3-113Manipulating MatricesSome of the functions, like sqrt and sin, are built-in. They are part of theMATLAB core so they are very efficient, but the computational details are notreadily accessible. Other functions, like gamma and sinh, are implemented inM-files. You can see the code and even modify it if you want.Several special functions provide values of useful constants.pi3.14159265…iImaginary unit, √-1jSame as iepsFloating-point relative precision, 2-52realminSmallest floating-point number, 2-1022realmaxLargest floating-point number, (2-ε)21023InfInfinityNaNNot-a-numberInfinity is generated by dividing a nonzero value by zero, or by evaluating welldefined mathematical expressions that overflow, i.e., exceed realmax.Not-a-number is generated by trying to evaluate expressions like 0/0 orInf-Inf that do not have well defined mathematical values.The function names are not reserved.

It is possible to overwrite any of themwith a new variable, such aseps = 1.e-6and then use that value in subsequent calculations. The original function canbe restored withclear eps3-12ExpressionsExamples of ExpressionsYou have already seen several examples of MATLAB expressions. Here are afew more examples, and the resulting values.rho = (1+sqrt(5))/2rho =1.6180a = abs(3+4i)a =5z = sqrt(besselk(4/3,rho-i))z =0.3730+ 0.3214ihuge = exp(log(realmax))huge =1.7977e+308toobig = pi*hugetoobig =Inf3-133Manipulating MatricesWorking with MatricesThis section introduces you to other ways of creating matrices.Generating MatricesMATLAB provides four functions that generate basic matrices.zerosAll zerosonesAll onesrandUniformly distributed random elementsrandnNormally distributed random elementsHere are some examples.Z = zeros(2,4)Z =000000F = 5*ones(3,3)F =55555555500N = fix(10*rand(1,10))N =4944R = randn(4,4)R =1.06680.29440.0593-1.3362-0.09560.7143-0.83231.62363-148-0.69180.85801.2540-1.59375-1.44100.5711-0.39990.69002680Working with MatricesThe load CommandThe load command reads binary files containing matrices generated by earlierMATLAB sessions, or reads text files containing numeric data.

The text fileshould be organized as a rectangular table of numbers, separated by blanks,with one row per line, and an equal number of elements in each row. Forexample, outside of MATLAB, create a text file containing these four lines.16.05.09.04.03.010.06.015.02.011.07.014.013.08.012.01.0Store the file under the name magik.dat. Then the commandload magik.datreads the file and creates a variable, magik, containing our example matrix.An easy way to read data into MATLAB in many text or binary formats is touse Import Wizard.M-FilesYou can create your own matrices using M-files, which are text files containingMATLAB code.

Use the MATLAB Editor or another text editor to create a filecontaining the same statements you would type at the MATLAB commandline. Save the file under a name that ends in .m.For example, create a file containing these five lines.A = [ ...16.03.05.010.09.06.04.015.02.011.07.014.013.08.012.01.0 ];Store the file under the name magik.m. Then the statementmagikreads the file and creates a variable, A, containing our example matrix.3-153Manipulating MatricesConcatenationConcatenation is the process of joining small matrices to make bigger ones.

Infact, you made your first matrix by concatenating its individual elements. Thepair of square brackets, [], is the concatenation operator. For an example, startwith the 4-by-4 magic square, A, and formB = [AA+32; A+48A+16]The result is an 8-by-8 matrix, obtained by joining the four submatrices.B =16594645357523106155158546321171450595562138121615660494837413632212520354238471926223134433946182723304540443329242817This matrix is half way to being another magic square.

Its elements are arearrangement of the integers 1:64. Its column sums are the correct value foran 8-by-8 magic square.sum(B)ans =260260260260260260260260But its row sums, sum(B')', are not all the same. Further manipulation isnecessary to make this a valid 8-by-8 magic square.3-16Working with MatricesDeleting Rows and ColumnsYou can delete rows and columns from a matrix using just a pair of squarebrackets. Start withX = A;Then, to delete the second column of X, useX(:,2) = []This changes X toX =16594211714138121If you delete a single element from a matrix, the result isn’t a matrix anymore.So, expressions likeX(1,2) = []result in an error. However, using a single subscript deletes a single element,or sequence of elements, and reshapes the remaining elements into a rowvector.

SoX(2:2:10) = []results inX =16927131213-173Manipulating MatricesMore About Matrices and ArraysThis section shows you more about working with matrices and arrays, focusingon:• Linear algebra• Arrays• Multivariate dataLinear AlgebraInformally, the terms matrix and array are often used interchangeably. Moreprecisely, a matrix is a two-dimensional numeric array that represents a lineartransformation. The mathematical operations defined on matrices are thesubject of linear algebra.Dürer’s magic squareA =16594310615211714138121provides several examples that give a taste of MATLAB matrix operations.You’ve already seen the matrix transpose, A'.

Adding a matrix to its transposeproduces a symmetric matrix.A + A'ans =32811178201723111714261723262The multiplication symbol, *, denotes the matrix multiplication involving innerproducts between rows and columns. Multiplying the transpose of a matrix bythe original matrix also produces a symmetric matrix.3-18More About Matrices and ArraysA'*Aans =378212206360212370368206206368370212360206212378The determinant of this particular matrix happens to be zero, indicating thatthe matrix is singular.d = det(A)d =0The reduced row echelon form of A is not the identity.R = rref(A)R =1000010000101-330Since the matrix is singular, it does not have an inverse. If you try to computethe inverse withX = inv(A)you will get a warning messageWarning: Matrix is close to singular or badly scaled.Results may be inaccurate.

RCOND = 1.175530e-017.Roundoff error has prevented the matrix inversion algorithm from detectingexact singularity. But the value of rcond, which stands for reciprocal conditionestimate, is on the order of eps, the floating-point relative precision, so thecomputed inverse is unlikely to be of much use.3-193Manipulating MatricesThe eigenvalues of the magic square are interesting.e = eig(A)e =34.00008.00000.0000-8.0000One of the eigenvalues is zero, which is another consequence of singularity.The largest eigenvalue is 34, the magic sum. That’s because the vector of allones is an eigenvector.v = ones(4,1)v =1111A*vans =34343434When a magic square is scaled by its magic sum,P = A/34the result is a doubly stochastic matrix whose row and column sums are all one.P =0.47060.14710.26470.11763-200.08820.29410.17650.44120.05880.32350.20590.41180.38240.23530.35290.0294More About Matrices and ArraysSuch matrices represent the transition probabilities in a Markov process.Repeated powers of the matrix represent repeated steps of the process.

For ourexample, the fifth powerP^5is0.25070.24970.25000.24960.24950.25010.24980.25060.24940.25020.24990.25050.25040.25000.25030.2493This shows that as k approaches infinity, all the elements in the kth power, Pk,approach 1/4.Finally, the coefficients in the characteristic polynomialpoly(A)are1-34-6421760This indicates that the characteristic polynomialdet( A - λI )isλ4 - 34λ3 - 64λ2 + 2176λThe constant term is zero, because the matrix is singular, and the coefficient ofthe cubic term is -34, because the matrix is magic!ArraysWhen they are taken away from the world of linear algebra, matrices becometwo dimensional numeric arrays.

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