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

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

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

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

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

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

All graphics objects have properties that controlthe appearance and behavior of the object. MATLAB enables you to query thevalue of each property and set the value of most properties.Whenever MATLAB creates a graphics object, it assigns an identifier (called ahandle) to the object. You can use this handle to access the object’s properties.Handle Graphics is useful if you want to:• Modify the appearance of graphs.• Create custom plotting commands by writing M-files that create andmanipulate objects directly.Graphics ObjectsGraphics objects are the basic elements used to display graphics and userinterface elements.

This table lists the graphics objects.4-26ObjectDescriptionRootTop of the hierarchy corresponding to the computerscreenFigureWindow used to display graphics and user interfacesAxesAxes for displaying graphs in a figureUicontrolUser interface control that executes a function inresponse to user interactionUimenuUser-defined figure window menuUicontextmenuPop-up menu invoked by right clicking on a graphicsobjectImageTwo-dimensional pixel-based pictureLightLight sources that affect the coloring of patch andsurface objectsHandle GraphicsObjectDescriptionLineLine used by functions such as plot, plot3, semilogxPatchFilled polygon with edgesRectangleTwo-dimensional shape varying from rectangles toovalsSurfaceThree-dimensional representation of matrix datacreated by plotting the value of the data as heightsabove the x-y planeTextCharacter stringObject HierarchyThe objects are organized in a tree structured hierarchy reflecting theirinterdependence.

For example, line objects require axes objects as a frame ofreference. In turn, axes objects exist only within figure objects. This diagramillustrates the tree structure.RootFigureUicontrolAxesImageLightUimenuLinePatchUicontextmenuRectangleSurfaceTextCreating ObjectsEach object has an associated function that creates the object. These functionshave the same name as the objects they create. For example, the text functioncreates text objects, the figure function creates figure objects, and so on.MATLAB’s high-level graphics functions (like plot and surf) call the4-274Graphicsappropriate low-level function to draw their respective graphics. For moreinformation about an object and a description of its properties, see thereference page for the object’s creation function. Object creation functions havethe same name as the object. For example, the object creation function for axesobjects is called axes.Commands for Working with ObjectsThis table lists commands commonly used when working with objects.FunctionPurposecopyobjCopy graphics objectdeleteDelete an objectfindobjFind the handle of objects having specified property valuesgcaReturn the handle of the current axesgcfReturn the handle of the current figuregcoReturn the handle of the current objectgetQuery the value of an objects propertiessetSet the value of an objects propertiesSetting Object PropertiesAll object properties have default values.

However, you may find it useful tochange the settings of some properties to customize your graph. There are twoways to set object properties:• Specify values for properties when you create the object.• Set the property value on an object that already exists.Setting Properties from Plotting CommandsYou can specify object property values as arguments to object creationfunctions as well as with plotting function, such as plot, mesh, and surf.4-28Handle GraphicsFor example, plotting commands that create lines or surfaces enable you tospecify property name/property value pairs as arguments.

The commandplot(x,y,'LineWidth',1.5)plots the data in the variables x and y using lines having a LineWidth propertyset to 1.5 points (one point = 1/72 inch). You can set any line object propertythis way.Setting Properties of Existing ObjectsTo modify the property values of existing objects, you can use the set commandor, if plot editing mode is enabled, the Property Editor. The Property Editorprovides a graphical user interface to many object properties. This sectiondescribes how to use the set command. See “Using the Property Editor” on page4-16 for more information.Many plotting commands can return the handles of the objects created so youcan modify the objects using the set command.

For example, these statementsplot a five-by-five matrix (creating five lines, one per column) and then set theMarker to a square and the MarkerFaceColor to green.h = plot(magic(5));set(h,'Marker','s',MarkerFaceColor','g')In this case, h is a vector containing five handles, one for each of the five linesin the plot. The set statement sets the Marker and MarkerFaceColor propertiesof all lines to the same values.Setting Multiple Property ValuesIf you want to set the properties of each line to a different value, you can usecell arrays to store all the data and pass it to the set command.

For example,create a plot and save the line handles.h = plot(magic(5));Suppose you want to add different markers to each line and color the marker’sface color to the same color as the line. You need to define two cell arrays – onecontaining the property names and the other containing the desired values ofthe properties.The prop_name cell array contains two elements.prop_name(1) = {'Marker'};4-294Graphicsprop_name(2) = {'MarkerFaceColor'};The prop_values cell array contains 10 values – five values for the Markerproperty and five values for the MarkerFaceColor property.

Notice thatprop_values is a two-dimensional cell array. The first dimension indicateswhich handle in h the values apply to and the second dimension indicateswhich property the value is assigned to.prop_values(1,1)prop_values(1,2)prop_values(2,1)prop_values(2,2)prop_values(3,1)prop_values(3,2)prop_values(4,1)prop_values(4,2)prop_values(5,1)prop_values(5,2)=========={'s'};{get(h(1),'Color')};{'d'};{get(h(2),'Color')};{'o'};{get(h(3),'Color')};{'p'};{get(h(4),'Color')};{'h'};{get(h(5),'Color')};The MarkerFaceColor is always assigned the value of the corresponding line’scolor (obtained by getting the line’s Color property with the get command).After defining the cell arrays, call set to specify the new property values.set(h,prop_name,prop_values)4-30Handle Graphics252015105011.522.533.544.55Finding the Handles of Existing ObjectsThe findobj command enables you to obtain the handles of graphics objects bysearching for objects with particular property values.

With findobj you canspecify the value of any combination of properties, which makes it easy to pickone object out of many. For example, you may want to find the blue line withsquare marker having blue face color.You can also specify which figures or axes to search, if there is more than one.The following sections provide examples illustrating how to use findobj.Finding All Objects of a Certain TypeSince all objects have a Type property that identifies the type of object, you canfind the handles of all occurrences of a particular type of object. For example,h = findobj('Type','line');finds the handles of all line objects.4-314GraphicsFinding Objects with a Particular PropertyYou can specify multiple properties to narrow the search. For example,h = findobj('Type','line','Color','r','LineStyle',':');finds the handles of all red, dotted lines.Limiting the Scope of the SearchYou can specify the starting point in the object hierarchy by passing the handleof the starting figure or axes as the first argument.

For example,h = findobj(gca,'Type','text','String','\pi/2');finds the string π/2 only within the current axes.Using findobj as an ArgumentSince findobj returns the handles it finds, you can use it in place of the handleargument. For example,set(findobj('Type','line','Color','red'),'LineStyle',':')finds all red lines and sets their line style to dotted.4-32Graphics User InterfacesGraphics User InterfacesHere is a simple example illustrating how to use Handle Graphics to build userinterfaces.

The statementb = uicontrol('Style','pushbutton', ...'Units','normalized', ...'Position',[.5 .5 .2 .1], ...'String','click here');creates a pushbutton in the center of a figure window and returns a handle tothe new object. But, so far, clicking on the button does nothing. The statements = 'set(b,''Position'',[.8*rand .9*rand .2 .1])';creates a string containing a command that alters the pushbutton’s position.Repeated execution ofeval(s)moves the button to random positions.

Finally,set(b,'Callback',s)installs s as the button’s callback action, so every time you click on the button,it moves to a new position.Graphical User Interface Design ToolsMATLAB provides GUI Design Environment (GUIDE) tools that simplify thecreation of graphical user interfaces. To display the GUIDE Layout Editor,issue the guide command.4-334GraphicsAnimationsMATLAB provides two ways of generating moving, animated graphics:• Continually erase and then redraw the objects on the screen, makingincremental changes with each redraw.• Save a number of different pictures and then play them back as a movie.Erase Mode MethodUsing the EraseMode property is appropriate for long sequences of simple plotswhere the change from frame to frame is minimal. Here is an example showingsimulated Brownian motion.

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