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

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

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

The vector contains indices of the points in V that are the vertices of theVoronoi cell. Each Voronoi cell may have a different number of points.Because a Voronoi cell can be unbounded, the first row of V is a point at infinity.Then any unbounded Voronoi cell in C includes the point at infinity, i.e., thefirst point in V.12-32InterpolationThis example uses the same X as in the Delaunay example, i.e., the 8 cornerpoints of a cube and its center. Random noise is added to make the cube lessregular.

The resulting Voronoi diagram has 9 Voronoi cells.d = [-1 1];[x,y,z] = meshgrid(d,d,d);X = [x(:),y(:),z(:)];% 8 corner points of a cubeX(9,:) = [0 0 0];% Add center to the vertex list.X = X+0.01*rand(size(X)); % Make the cube less regular.[V,C] = voronoin(X);V =Inf0.00550.00370.00520.00300.0072-1.7912-1.4886-1.48860.01011.51151.51150.01040.0026Inf1.50540.01010.00871.50540.00720.00000.00110.00020.00440.00740.0081-1.4846-1.4846Inf0.0004-1.4990-1.49900.00301.49710.00440.00360.00451.49710.00330.0040-0.00070.0071C =[1x8 double][1x6 double][1x4 double][1x6 double][1x6 double][1x6 double][1x6 double][1x6 double][1x12 double]In this example, V is a 13-by-3 matrix, the 13 rows are the coordinates of the 13Voronoi vertices.

The first row of V is a point at infinity. C is a 9-by-1 cell array,12-3312Polynomials and Interpolationwhere each cell in the array contains an index vector into V corresponding toone of the 9 Voronoi cells. For example, the 9th cell of the Voronoi diagram isC{9} = 2 3 4 5 6 7 8 9 10 11 12 13If any index in a cell of the cell array is 1, then the corresponding Voronoi cellcontains the first point in V, a point at infinity. This means the Voronoi cell isunbounded.To view a bounded Voronoi cell, i.e., one that does not contain a point atinfinity, use the convhulln function to compute the vertices of the facets thatmake up the Voronoi cell.

Then use patch and other plot functions to generatethe figure. For example, this code plots the Voronoi cell defined by the 9th cellin C.X = V(C{9},:);% View 9th Voronoi cell.K = convhulln(X);figurehold ond = [1 2 3 1];% Index into Kfor i = 1:size(K,1)j = K(i,d);h(i)=patch(X(j,1),X(j,2),X(j,3),i,'FaceAlpha',0.9);endhold offview(3)axis equaltitle('One cell of a Voronoi diagram')12-34InterpolationInterpolating N-Dimensional DataUse the griddatan function to interpolate multidimensional data, particularlyscattered data.

griddatan uses the delaunayn function to tessellate the data,and then interpolates based on the tessellation.Suppose you want to visualize a function that you have evaluated at a set of nscattered points. In this example, X is an n-by-3 matrix of points, each rowcontaining the (x,y,z) coordinates for one of the points. The vector v containsthe n function values at these points. The function for this example is thesquared distance from the origin, v = x.^2 + y.^2 + z.^2.Start by generating n = 5000 points at random in three-dimensional space, andcomputing the value of a function on those points.n = 5000;X = 2*rand(n,3)-1;v = sum(X.^2,2);12-3512Polynomials and InterpolationThe next step is to use interpolation to compute function values over a grid.

Usemeshgrid to create the grid, and griddatan to do the interpolation.delta = 0.05;d = -1:delta:1;[x0,y0,z0] = meshgrid(d,d,d);X0 = [x0(:), y0(:), z0(:)];v0 = griddatan(X,v,X0);v0 = reshape(v0, size(x0));Then use isosurface and related functions to visualize the surface that consistsof the (x,y,z) values for which the function takes a constant value. You couldpick any value, but the example uses the value 0.6. Since the function is thesquared distance from the origin, the surface at a constant value is a sphere.p = patch(isosurface(x0,y0,z0,v0,0.6));isonormals(x0,y0,z0,v0,p);set(p,'FaceColor','red','EdgeColor','none');view(3);camlight;lighting phongaxis equaltitle('Interpolated sphere from scattered data')Note A smaller delta produces a smoother sphere, but increases thecompute time.12-36Interpolation12-3712Polynomials and InterpolationSelected Bibliography[1] National Science and Technology Research Center for Computation andVisualization of Geometric Structures (The Geometry Center), University ofMinnesota.

1993. For information about qhull, seehttp://www.geom.umn.edu/software/qhull/.[2] Parker, Robert. L., Loren Shure, & John A. Hildebrand, “The Application ofInverse Theory to Seamount Magnetism.” Reviews of Geophysics. Vol. 25, No. 1,1987.12-3813Data Analysis andStatisticsColumn-Oriented Data Sets . . . . . . .

. . . . . . 13-4Basic Data Analysis Functions . . .Function Summary . . . . . . . . .Covariance and Correlation CoefficientsFinite Differences . . . . . . . . .................................. 13-8. 13-813-1113-12Data Preprocessing . . . . . . . .

. . . . . . . . 13-14Missing Values . . . . . . . . . . . . . . . . . . 13-14Removing Outliers . . . . . . . . . . . . . . . . . 13-15Regression and Curve Fitting . .Polynomial Regression . . . . . .Linear-in-the-Parameters RegressionMultiple Regression . . . .

. . .....................................13-1713-1813-1913-21Case Study: Curve FittingPolynomial Fit . . . . . .Analyzing Residuals . . .Exponential Fit . . . . .Error Bounds . . . . . .The Basic Fitting Interface .......................................................13-2213-2213-2413-2713-3013-31........................Difference Equations and Filtering.

. . . . . . . 13-40Fourier Analysis and the Fast FourierTransform (FFT) . . . . . . . .Function Summary . . . . . . . . . .Introduction . . . . . . . . . . . . .Magnitude and Phase of Transformed DataFFT Length Versus Speed . . . . . . ....................................13-4313-4313-4413-4913-5013Data Analysis and StatisticsThis chapter introduces MATLAB’s data analysis capabilities.

It discusses howto organize arrays for data analysis, how to use simple descriptive statisticsfunctions, and how to perform data preprocessing tasks in MATLAB. It alsodiscusses other data analysis topics, including regression, curve fitting, datafiltering, and fast Fourier transforms (FFTs). It includes:Column-Oriented Data SetsOrganizing arrays for data analysis.Basic Data Analysis FunctionsBasic data analysis functions and an example that uses some of the functions.This section also discusses functions for the computation of correlationcoefficients and covariance, and for finite difference calculations.Data PreprocessingWorking with missing values, and outliers or misplaced data points in a dataset.Regression and Curve FittingInvestigates the use of different regression methods to find functions thatdescribe the relationship among observed variables.Case Study: Curve FittingUses a case study to look at some of MATLAB’s basic data analysis capabilities.This section also provides information about the Basic Fitting interface.Difference Equations and FilteringDiscusses MATLAB functions for working with difference equations andfilters.Fourier Analysis and the Fast Fourier Transform (FFT)Discusses Fourier analysis in MATLABData Analysis and Statistics FunctionsThe data analysis and statistics functions are in the directory datafun in theMATLAB Toolbox.

Use online help to get a complete list of functions.13-2Related ToolboxesA number of related toolboxes provide advanced functionality for specializeddata analysis applications.ToolboxData Analysis ApplicationOptimizationNonlinear curve fitting and regression.Signal ProcessingSignal processing, filtering, and frequencyanalysis.SplineCurve fitting and regression.StatisticsAdvanced statistical analysis, nonlinear curvefitting, and regression.System IdentificationParametric / ARMA modeling.WaveletWavelet analysis.13-313Data Analysis and StatisticsColumn-Oriented Data SetsUnivariate statistical data is typically stored in individual vectors. The vectorscan be either 1-by-n or n-by-1.

For multivariate data, a matrix is the naturalrepresentation but there are, in principle, two possibilities for orientation. ByMATLAB convention, however, the different variables are put into columns,allowing observations to vary down through the rows. Therefore, a data setconsisting of twenty four samples of three variables is stored in a matrix of size24-by-3.Vehicle Traffic Sample Data SetConsider a sample data set comprising vehicle traffic count observations atthree locations over a 24-hour period.Vehicle Traffic Sample Data Set13-4TimeLocation 1Location 2Location 301h001111902h007131103h0014172004h001113905h0043516906h0038467607h006113218608h007513518009h00388811510h0028365511h0012121412h0018273013h00181929Column-Oriented Data SetsVehicle Traffic Sample Data Set (Continued)TimeLocation 1Location 2Location 314h0017151815h0019364816h0032471017h0042659218h00576615119h0044559020h0011414525721h0035586822h0011121523h001391524h001097Loading and Plotting the DataThe raw data is stored in the file, count.dat.1171411433861753828121818171911131713514613213588361227191536911209697618618011555143029184813-513Data Analysis and Statistics3242574411435111310476566551455812991092151902576815157Use the load command to import the data.load count.datThis creates the matrix count in the workspace.For this example, there are 24 observations of three variables.

This isconfirmed by[n,p] = size(count)n =24p =3Create a time vector, t, of integers from 1 to n.t = 1:n;Now plot the counts versus time and annotate the plot.set(0,'defaultaxeslinestyleorder','-|--|-.')set(0,'defaultaxescolororder',[0 0 0])plot(t,count), legend('Location 1','Location 2','Location 3',2)xlabel('Time'), ylabel('Vehicle Count'), grid onThe plot shows the vehicle counts at three locations over a 24-hour period.13-6Column-Oriented Data Sets300Location 1Location 2Location 3250Vehicle Count2001501005000510152025Time13-713Data Analysis and StatisticsBasic Data Analysis FunctionsThis section introduces functions for:• Basic column-oriented data analysis• Computation of correlation coefficients and covariance• Calculating finite differencesFunction SummaryA collection of functions provides basic column-oriented data analysiscapabilities.

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

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

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

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