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

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

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

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

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

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

The characters \pi create the symbol π.xlabel('x = 0:2\pi')ylabel('Sine of x')title('Plot of the Sine Function','FontSize',12)4-2Basic PlottingPlot of the Sine Function10.80.60.4Sine of x0.20−0.2−0.4−0.6−0.8−101234567x = 0:2πMultiple Data Sets in One GraphMultiple x-y pair arguments create multiple graphs with a single call to plot.MATLAB automatically cycles through a predefined (but user settable) list ofcolors to allow discrimination between each set of data. For example, thesestatements plot three related functions of x, each curve in a separatedistinguishing color.y2 = sin(x-.25);y3 = sin(x-.5);plot(x,y,x,y2,x,y3)The legend command provides an easy way to identify the individual plots.legend('sin(x)','sin(x-.25)','sin(x-.5)')4-34Graphics1sin(x)sin(x−.25)sin(x−.5)0.80.60.40.20−0.2−0.4−0.6−0.8−101234567Specifying Line Styles and ColorsIt is possible to specify color, line styles, and markers (such as plus signs orcircles) when you plot your data using the plot command.plot(x,y,'color_style_marker')color_style_marker is a string containing from one to four characters(enclosed in single quotation marks) constructed from a color, a line style, anda marker type:• Color strings are 'c', 'm', 'y', 'r', 'g', 'b', 'w', and 'k'.

These correspondto cyan, magenta, yellow, red, green, blue, white, and black.• Linestyle strings are '-' for solid, '--' for dashed, ':' for dotted, '-.' fordash-dot. Omit the linestyle for no line.• The marker types are '+', 'o', '*', and 'x' and the filled marker types 's'for square, 'd' for diamond, '^' for up triangle, 'v' for down triangle, '>'4-4Basic Plottingfor right triangle, '<' for left triangle, 'p' for pentagram, 'h' for hexagram,and none for no marker.You can also edit color, line style, and markers interactively. See “EditingPlots” on page 4-14 for more information.Plotting Lines and MarkersIf you specify a marker type but not a linestyle, MATLAB draws only themarker.

For example,plot(x,y,'ks')plots black squares at each data point, but does not connect the markers witha line.The statementplot(x,y,'r:+')plots a red dotted line and places plus sign markers at each data point. Youmay want to use fewer data points to plot the markers than you use to plot thelines. This example plots the data twice using a different number of points forthe dotted line and marker plots.x1 = 0:pi/100:2*pi;x2 = 0:pi/10:2*pi;plot(x1,sin(x1),'r:',x2,sin(x2),'r+')4-54Graphics10.80.60.40.20−0.2−0.4−0.6−0.8−101234567Imaginary and Complex DataWhen the arguments to plot are complex, the imaginary part is ignored exceptwhen plot is given a single complex argument.

For this special case, thecommand is a shortcut for a plot of the real part versus the imaginary part.Therefore,plot(Z)where Z is a complex vector or matrix, is equivalent toplot(real(Z),imag(Z))For example,t = 0:pi/10:2*pi;plot(exp(i*t),'-o')axis equal4-6Basic Plottingdraws a 20-sided polygon with little circles at the vertices. The command,axis equal, makes the individual tick mark increments on the x- and y-axesthe same length, which makes this plot more circular in appearance.10.80.60.40.20−0.2−0.4−0.6−0.8−1−1−0.500.51Adding Plots to an Existing GraphThe hold command enables you to add plots to an existing graph.

When youtypehold onMATLAB does not replace the existing graph when you issue another plottingcommand; it adds the new data to the current graph, rescaling the axes ifnecessary.For example, these statements first create a contour plot of the peaks function,then superimpose a pseudocolor plot of the same function.[x,y,z] = peaks;contour(x,y,z,20,'k')hold on4-74Graphicspcolor(x,y,z)shading interphold offThe hold on command causes the pcolor plot to be combined with the contourplot in one figure.Figure WindowsGraphing functions automatically open a new figure window if there are nofigure windows already on the screen. If a figure window exists, MATLAB usesthat window for graphics output. If there are multiple figure windows open,MATLAB targets the one that is designated the “current figure” (the last figureused or clicked in).To make an existing figure window the current figure, you can click the mousewhile the pointer is in that window or you can typefigure(n)4-8Basic Plottingwhere n is the number in the figure title bar.

The results of subsequentgraphics commands are displayed in this window.To open a new figure window and make it the current figure, typefigureMultiple Plots in One FigureThe subplot command enables you to display multiple plots in the samewindow or print them on the same piece of paper. Typingsubplot(m,n,p)partitions the figure window into an m-by-n matrix of small subplots and selectsthe pth subplot for the current plot. The plots are numbered along first the toprow of the figure window, then the second row, and so on.

For example, thesestatements plot data in four different subregions of the figure window.t = 0:pi/10:2*pi;[X,Y,Z] = cylinder(4*cos(t));subplot(2,2,1); mesh(X)subplot(2,2,2); mesh(Y)subplot(2,2,3); mesh(Z)subplot(2,2,4); mesh(X,Y,Z)4-94Graphics5500−5404020−5400 0200 0110.50.50404020402020200 005500−5 −5Controlling the AxesThe axis command supports a number of options for setting the scaling,orientation, and aspect ratio of plots. You can also set these optionsinteractively. See “Editing Plots” on page 4-14 for more information.Setting Axis LimitsBy default, MATLAB finds the maxima and minima of the data to choose theaxis limits to span this range. The axis command enables you to specify yourown limitsaxis([xmin xmax ymin ymax])4-10Basic Plottingor for three-dimensional graphs,axis([xmin xmax ymin ymax zmin zmax])Use the commandaxis autoto re-enable MATLAB’s automatic limit selection.Setting Axis Aspect Ratioaxis also enables you to specify a number of predefined modes.

For example,axis squaremakes the x-axes and y-axes the same length.axis equalmakes the individual tick mark increments on the x- and y-axes the samelength. This meansplot(exp(i*[0:pi/10:2*pi]))followed by either axis square or axis equal turns the oval into a propercircle.axis auto normalreturns the axis scaling to its default, automatic mode.Setting Axis VisibilityYou can use the axis command to make the axis visible or invisible.axis onmakes the axis visible. This is the default.axis offmakes the axis invisible.4-114GraphicsSetting Grid LinesThe grid command toggles grid lines on and off. The statementgrid onturns the grid lines on andgrid offturns them back off again.Axis Labels and TitlesThe xlabel, ylabel, and zlabel commands add x-, y-, and z-axis labels. Thetitle command adds a title at the top of the figure and the text functioninserts text anywhere in the figure.

A subset of TeX notation produces Greekletters. You can also set these options interactively. See “Editing Plots” on page4-14 for more information.t = -pi:pi/100:pi;y = sin(t);plot(t,y)axis([-pi pi -1 1])xlabel('-\pi \leq {\itt} \leq \pi')ylabel('sin(t)')title('Graph of the sine function')text(1,-1/3,'{\itNote the odd symmetry.}')4-12Basic PlottingGraph of the sine function10.80.60.4sin(t)0.20−0.2Note the odd symmetry.−0.4−0.6−0.8−1−3−2−10−π ≤ t ≤ π123Saving a FigureTo save a figure, select Save from the File menu. To save it using a graphicsformat, such as TIFF, for use with other applications, select Export from theFile menu.

You can also save from the command line – use the saveascommand, including any options to save the figure in a different format.4-134GraphicsEditing PlotsMATLAB formats a graph to provide readability, setting the scale of axes,including tick marks on the axes, and using color and line style to distinguishthe plots in the graph. However, if you are creating presentation graphics, youmay want to change this default formatting or add descriptive labels, titles,legends and other annotations to help explain your data.MATLAB supports two ways to edit the plots you create.• Using the mouse to select and edit objects interactively• Using MATLAB functions at the command-line or in an M-fileInteractive Plot EditingIf you enable plot editing mode in the MATLAB figure window, you can performpoint-and-click editing of the objects in your graph.

In this mode, you select theobject or objects you want to edit by double-clicking on it. This starts theProperty Editor which provides access to properties of the object that controlits appearance and behavior.For more information about interactive editing, see “Using Plot Editing Mode”on page 4-15. For information about editing object properties in plot editingmode, see “Using the Property Editor” on page 4-16.Note Plot editing mode provides an alternative way to access the propertiesof MATLAB graphic objects. However, you can only access a subset of objectproperties through this mechanism. You may need to use a combination ofinteractive editing and command line editing to achieve the effect you desire.Using Functions to Edit GraphsIf you prefer to work from the MATLAB command line or if you are creating anM-file, you can use MATLAB commands to edit the graphs you create.

Takingadvantage of MATLAB’s Handle Graphics system, you can use the set and getcommands to change the properties of the objects in a graph. For moreinformation about using command line, see “Handle Graphics” on page 4-26.4-14Editing PlotsUsing Plot Editing ModeThe MATLAB figure window supports a point-and-click style editing mode thatyou can use to customize the appearance of your graph. The followingillustration shows a figure window with plot editing mode enabled and labelsthe main plot editing mode features.Use these toolbar buttons to add text, arrows, and lines to a graph.Click this button to start plotedit mode.Use the Edit, Insert, and Toolsmenus to add objects or editexisting objects in the graph.Double-click on an object toselect it.Position labels, legends, andother objects by clicking anddragging them.Access object-specific plotedit functions throughcontext-sensitive pop-upmenus.4-154GraphicsUsing the Property EditorIn plot editing mode, you can use a graphical user interface, called the PropertyEditor, to edit the properties of objects in the graph.

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