New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Mrs. Kelly Wilkinson


Mrs. Kelly Wilkinson
GPA 3.52


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Environmental Health, Science, And Policy

This 96 page Class Notes was uploaded by Mrs. Kelly Wilkinson on Saturday September 12, 2015. The Class Notes belongs to Environ 8 at University of California - Irvine taught by Staff in Fall. Since its upload, it has received 37 views. For similar materials see /class/201884/environ-8-university-of-california-irvine in Environmental Health, Science, And Policy at University of California - Irvine.

Similar to Environ 8 at UCI

Popular in Environmental Health, Science, And Policy




Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/12/15
Software Tools amp Methods Class 8 Lecturer Greg Bolcer gregbolcerorg Summer Session 2009 ELH 110 9am11250am Overview Last Class Scrum Review Testing 0 This Class eXtreme Programming review Use cases 0 Next Class Final Smt39iswa ire Methmdg 8a TGGWS EXTREME PROGRAMMING Extreme Programming XP Kent Beck invented XP by the seat of his pants in 1996 to fix a disastrous project at Chrysler quotExtreme Programming Explained Embrace Change by Beck published in 1999 Version 20 published in 2004 Tries to associate with a software process with extreme sports Idea Take a good programming practice and push it to the extreme Example testing Since testing is good do it all the time even before we have code Week 7 Slide Current Reasons for Popularity Effectiveness Results Compatibility with web applications Cool factor Week 7 Slide 5 Extreme Practices f code reviews are good we ll review all the time pair programming f testing is good everybody will test all the time unit testing If design is good we ll make it part of everybody s daily business refactoring f simplicity is good we ll always leave the system with the simplest design that supports the functionality the simplest thing that could possibly work If architecture is important everybody will work defining and refining the architecture all the time metaphor f integration testing is important then we ll integrate and test several times a day continuous integration f short iterations are good we ll make the iterations really really short seconds and minutes and hours not weeks and months and years the Planning Game Week 7 Slide 6 Twelve Key Practices of XP Programmer Practices Simple Design Test driven development Refactoring Pair programming Collective code ownership Continuous integration Coding standards Management Practices Planning Game Small releases 40 hour week Customer Practices On site customer Metaphor Week 7 Slide 7 XP Metaphor Metaphor is the architecture of the system described in a way that facilitates communication Practice of Agile most ignored by practioners though communication is cited as key value Giving examples cleaner way to describe Check against metaphor after first design Check against metaphor after completed system Drawings and words that capture aspects of the system ICrtealte unique language and meaning that is used as a a e Saf iswa re Methadg 8a TGGIS PLANNING GAME Planning Game 0 Planning and project management are tricky to get right burdensome and can be the most emotionally charged part of developing software 0 The Planning Game creates some distance between planning and participants by treating it like a game Planning Game Like most games has Goal playing pieces players rules Pieces A User Story each story written on an index card Goal to put the greatest possible value of stories into production over the life of the project Players business and development Planning Game Moves Write story business writes a story at any time and assign a value with enough info that it can be assigned a dev cost Estimate story development takes story and assignes and estimate of 1 2 3 weeks of Ideal programming time 3 real weeks 1 Ideal week Make commitment business and development pick which stories make the cut for next release Story driven commitment Development agrees to take on story for next release until time commitment filled up Date driven commitment Business picks a release date development calculates the cost of stories they can accomplish by that date business picks stories that add up to that number Value and riskfirst Development orders stories in commitment so Fully working but sketchy system is done immediately first two weeks More valuable stories are moved earlier in schedule Riskier stories are moved earlier in the schedule Planning Game Moves Overcommitment Recovery Development provides new estimates eg 100 units of value vs 150 business repicks stories to implement or defers deadline Change Value Business changes the value of a story development changes order of stories in current commitment Introduce New Story Business writes new story development assigns costs reevaluates Value and Risk Split Story Business splits a story into two or more because resources do not allow it to be done all at once Spike Business writes a story to divert resources to do a throwaway spike to fight a fire reduce risk or prove a concept ReEstimate Development is asked at any given point in time to re estimate the remaining stories Planning Game Workflow Q e Exploration Phase Planning Game Wo rk F low l3 valchaelKamelm a 3 Weelt5 amp Richard Kamel m amp Marcel Hellng an 2 ash7751 s Split a stow E Commitment Phase El l3 Steering Phase es to New stow Iteration Planning Game run Functional Te E Business Development OED Sa swa re Methmdg 8a Taa g AGILE METHODS REVIEW Rational Unified Process RUP is a software development process that is Use case driven Architecture centric Iterative and incremental Week 7 Slicle 16 Use Case Driven Use cases are the primary artifact for establishing the behavior of the system verifying and validating the system s architecture testing and communicating with stakeholders Start with use cases Talk to users to find out what the system is supposed to do Week 7 Slide 17 Architecturecentric Architecturecentric means that a system s architecture is used as the primary artifact for conceptualizing constructing managing and evolving the system under development Create a big picture ofthe system first 0 Then add details Week 7 Slide 13 Use Cases Use case diagrams are just visual representations of use cases Use cases are text This is the important stuff Larman p 64 Use cases are text documents not diagrams and use case modeling is primarily an act of writing text no drawing diagrams Week 7 Slide 19 Use Cases Simple Written in natural language Different stakeholders can participate Emphasize user goals and perspective Helps keep the big picture in focus Week 7 Slicle 2O Saf tware Methads 8 TOOIS USE CASES Elements of Use Cases Actor Something with behavior eg person really a role computer system or organization Scenario Specific sequence of actions Also use case instance Main Success Scenario A typical unconditional path to success Week 7 Slide 23 How to write use cases How are you going to use your use case This will help with later decisions Audience Customers managers developers testers etc Level of detail Brief A 1paragraph summary Casual Multiple paragraphs informal text Fully dressed All steps and variations in detail A use case template is helpful Level of granularity Start by identifying the system boundary Week 7 Slide 24 PLEAS TURN OFF ENGINE No SMOKING P Remove Select Operate Nozzle Grade Handle my THIS SALE 8 GALLONS PRICE PER GALLON S PREMIUM UNLEADED ADED pLUS UNLEADED PRICE PER GALLON s PRICE PER GALLON s Week 7 Slide 25 Use Cases In general a use case should cover the full sequence of steps from the beginning of a task until the end A use case should describe the user s interaction with the system not the computations the system performs not a state machine A use case should independent of any particular user interface design 6 z C L Susan l lott Sim 7001 Week 8 Slide 26 Advantages of Use Cases Use cases are fast and easy to write after some practice They require no training to read Use cases are fairly concrete examples of how the system could be used Use cases are examples of usage Starting with just a few examples is easy More examples can be added incrementally as needed a S n g I 2 L bu an El Iott Sun 009 Week 8 Slide 27 Three Tests for Level of Granularity The Boss Test Ask quotWhat have you been doing all day Would the answer make the actor s boss happy The EBP Enterprise Business Process Test Task performed by one person in one place at one time Responds to a business event Adds business value The Size Test More than a single step Fullydressed version is usually 310 pages a S g 2 L bu an Elllott Sun 009 Week 8 Slide 23 How to write use case Choose the System Boundary Who or what are on the outside On the inside Find Primary Actors and Goals Define Use Case Start the name of use cases with a verb Write Main Success Scenario The use case should focus on one success Possible error conditions or other failures are simply noted as extensions to the main success scenario Detail the steps to be take to achieve the desired goal Include enough detail to check for correctness E z C L Susan Llllott Sim 2001 Week 8 Slide 29 How to write use cases As you go add notes to yourself and questions to come back to Are there any preconditions that you assumed Are there alternative ways to accomplish the same thing Eg cash withdrawal vs fast cash You can note them as extensions or write whole new use cases Are there ways that the user can fail Note some as extensions 5 S 2 L bu an Elllott Sun 009 Week 8 Slide 30 Elements of Use Case Diagrams The main purposes of a use case diagram Show all the names of the use cases like a table of contents Show relationships between actors and use cases Show relationships between use cases Stick figure Actor Oval Use case Extension Optional interactions to cover exceptions Inclusion For common substeps can be reused in diagram Generalization Like superclasses for representing several similar use cases a S g 2 L bu an Elllott Sun 009 Week 8 Slide 31 PLEAS TURN OFF ENGINE No SMOKING P Remove Select Operate Nozzle Grade Handle my THIS SALE 8 GALLONS PRICE PER GALLON S PREMIUM UNLEADED ADED pLUS UNLEADED PRICE PER GALLON s PRICE PER GALLON s Week 8 Slide 32 Use Case Diagram Telephone Shopping check sbtus 053 Customer i quot m ng Cle39k establish credit 2 SupeNisor Salesperson Susan Elliott Sim 2009 Weel 8 Slide 33 Elements of Use Case Diagrams Extension Optional interactions to cover exceptions 0 Inclusion For common substeps can be re used in diagram Generalization Like superclasses for representing several similar use cases a S n g I 2 L so an El Iott Sun 009 Week 8 Slide 34 Example of generalization extension and inclusion V Ordinary User 0P9quot 39e Open le by typing name Open le by bmwsing ltltincludegtgt extend System Adm39nistrator O Attemli to open alile that does not exst Bruwse fa fie Susan Elliott Sim 2009 Week 8 Slide 3 Whiteboard Exercise Use Case A driver needs to fill up their car with gas The station requires the driver to pay first Payments methods include paying with a credit card or check card at the pump or paying with cash which is collected by the attendant inside the station Once a payment method is established the attendant approves the distribution of gas at the particular pump and the driver fills up the car After the car is full the pump will print a receipt If no receipt is available the driver may request a receipt from the attendant pay with credit card 4rpajwith check card Pay Attendant O pay with cash gt Fill Up Gas Driver Put Gas In Car ltltextendgtgt receipt lecelptfalls in print Sa swa re Methmdg 8a Taa g SEQUENCE DIAGRAMS Sequence Diagrams Are a method of visually coding sequences of events Like all models used as an abstraction Includes time based durations and precedence ordering Actors are listed on top of diagram in boxes with dashed lines vertically below Entry state and exit states similar to UML diagrams can have a closed ball with an arrow andor an quotXquot to exit Partial arrows represent asynchronous events where the actor doesn t wait for the completion of the action before continuing Use Case Fred is a patron at a local restaurant He goes in sits down and orders food and wine from the Waiter Bob Bob passes the food order on to Hank the cook and comes back to serve Fred the wine When the food is ready Bob picks up the food order from Hank and serves the food to Fred When Fred is done with his meal he pays Renee the cashier and leaves Saf iswa re Methadg 8a TGGIS STATE DIAGRAMS State Diagrams 0 A visual diagram that models a software system using a discrete number of states and transitions Represents a reasonable abstraction Used to describe behavior of system Taylor Booth 1967 Finite State Machines UML State Diagram standard format UML State Diagrams lSmnl Simulator running Ml amte Simulator paused lowait Data l meted Comimcl 1 1quot 1 g Filled circleipointingto initial state Hollow circle containing a smaller filled circle indicating the final state if any Rounded rectangle denoting a state Top of the rectan le contains a name of the state Can contain a horizontal line in the middle below which the activities that are done in that state are indicated Arrow denoting transition The name of the event if any causing this transition labels the arrow body A guard expression may e before a quotquot and enclosed in squarerbrackets ventNumeLguardExpression denotin that this expression must be true ort e ta e placetl an action is per forme uringt IS transition it is added to the label following a quotquot eventNameguardExpressionaction m m respectively State Transition Example Start at initial state Outgoing arrows represent state changes When in a given state only the transitions listed are possible Chapter 8 Graphics in Matlab 81 Elementary 2D Graphs Matlab provides several functions used to produce 2 D plots giving the user choices of colors line styles axis scales and axis placement 0 plot plots data using linear scales on both the w and y axes It has the following usages plot xy plots y versus x If either is a matrix the rows or columns of the matrix are plotted against the vector Whichever lines up plot A plots each columns of A versus row indices if A is real If A is complex the real part is plotted against the imaginary part plot xy 5 plots y versus x using the line type speci ed by the string 5 plot x1y1slx2y2s2 plots y1 versus x1 using line style 51 and so on o semilogy is the same as plot except that a logarithmic scale is used along the y axis Similarly semilogx uses a logarithmic scale along the w axis and loglog uses a logarithmic scale on both axes o polar plots a vector of angles in radians versus a vector of radii It accepts as a third argument the same color and line style strings as plot 233 o plotyy plots two sets of vectors on the same graph with y tick labels on the left corresponding to one set of vectors and y tick labels also on the right for the other set 811 Line Styles A line style is speci ed by a string of up to three characters consisting of at most one character from any of the three categories 0 Colors 0 Point Type 0 Line Type The help page on plot lists the valid characters for each of these three categories 812 Axis Control The axis command controls scaling and appearance of plot axes 0 axis xmin xmax ymin ymax sets the scaling for the w and y axes on the current plot 0 axis xmin xmax ymin ymax zmin zmax sets the scaling for the w y and z axes on the current plot axis with no arguments returns a row vector containing the scaling for the current plot of the form xmin xmax ymin ymax for 2D plots or xmin xmax ymin ymax zmin zmax for 3D plots 0 axis auto sets axis scaling to its default Where for each dimension limits are chosen based on the data being plotted typically providing some padding 0 axis tight sets axis limits to the range of the data 0 axis manual freezes the scaling at the current limits so that subse quent plots will use those same limits 0 axis ij puts Matlab into matrix axes mode used by spy 0 axis xy puts Matlab into Cartesian axes mode the default 234 Other Axis Commands All of these commands accept on and off as arguments with no arguments they simply toggle the given feature zoom allows one to zoom in and out on the current plot Use zoom on and zoom off to toggle the 200m state When zoom is on the mouse may be used to zoom in or out left click zooms in and right click zooms out 0 grid allows grid lines to be added to the current plot box addds a box to the current axes hold freezes the current plot and all axis properties so that subsequent plots will add to the existing plot The use of grid is illustrated in Figure 81 and the use of box is shown in Figure 82 Axis Creation The subplot and axes commands create sets of axes in the current gure window axes position left bottom width height creates an axis at the arbitrary position left bottom in the window with the given width and height The coordinates are normalized with O 0 corresponding to the lower left corner and 1010 to the upper right corner subplot mnp creates an m X 71 matrix of tiled axes selecting the pth one for future plotting commands V V subplot321 plotsin120 subplot325 plotexp120 subplot324 plotyy120sin120120exp120 VVVVV VVVVV The resulting plot is shown in Figure 83 235 y X Figure 81 An example of the use of grid 236 y X Figure 82 An example of the use of box 237 1 04 05 03 0 02 05 01 1 0 0 5 10 15 20 04 02 0 0 5 10 15 20 Figure 83 The use of subplot to display multiple plots in the same gure Note the use of plotyy in the middle set of axes 238 813 Graph Annotation Once data is plotted it is often desirable to clearly label what is being plotted as such plots are often used in presentations and can be confus ing without the proper annotation To that end Matlab provides these functions 0 title sets the title of the current plot xlabel ylabel and zlabel sets the text beside the w axis y axis or 2 axis of the current plot 0 legend creates a legend for the current plot using given strings as labels 0 text accepts coordinates x and y for 2D or w y and z for 3D and a string and adds the string at the given location on the current plot 0 gtext is similar to text except that the point is speci ed by clicking the mouse at the desired point on the current plot gtgt plot1100sin2pi1100100 0 gtgt hold Current plot held gtgt plot1100cos2pi1100100 gtgt xlabel x gtgt ylabel y gtgt title Plot example gtgt text300 cosx gtgt text5005 sinx gtgt legend sin cos The annotated graph is shown in Figure 84 Various constructs from LaTeX can be used in annotations as illustrated in the following example The corresponding plot is shown in Figure 85 gtgt t00011 gtgt yexp2t gtgt plotty gt xlabel t gt ylabel y gtgt title yt y0 equotlambda t lambda 2 y0 1 VV 239 240 Figure 84 An annotated graph Plot example yty0 e x2 y01 01 02 03 04 05 06 07 08 09 Figure 85 An annotated graph using LaTeX constructs 241 82 3D Graphics Matlab is also capable of producing plots in three dimensions With a 3D plot unlike a 2D plot it is often desirable to view the plot from different angles For this purpose Matlab provides several functions for simulating arbitrary camera and light source77 placement 821 Elementary 3D plots The followin functions are used to plot curves or surfaces in 3 D o plot3 is the 3D version of plot accepting vectors or matrices corre sponding to w y and 2 values as well as line styles 0 mesh plots a mesh surface accepting w y and 2 values as well as an optional color speci cation 0 surf is simliar to mesh except that it plots a solid colored surface rather than a mesh surface 0 f 1113 lls the polygon described by the data with a given color Both mesh and surf can accept a matrix of z values where z is a function of w and 3 If x and y are omitted they are assumed to be 1 n and 1 m respectively where z is m X 71 gtgt for i1z20 for j1z20 Zij sinij20 end end gtgt meshZ gtgt surfZ The plot created using mesh is displayed in Figure 86 While the plot created using surf is shown in Figure 87 The following code uses f 1113 to produces a red octagon in 3D V V xcospi82pi188 ysinpi82pi188 gtgt zy fill3xyz r xlabel x V V VV VV 242 Figure 86 Surface plotted using mesh 243 Figure 87 Surface plotted using surf 244 Figure 88 Octagon lled in using 1113 gtgt ylabel y gtgt zlabel z The octagon is shown in Figure 88 822 Lighting The shading of a 3 D object is determined by the location of a light source Matlab produces 3 D plots with a virtual light source at a given location in space7 and allows the user to change that location 0 surfl is like surf7 except that it draws the surface with highlights as though from a light source An example of surfl appears in Figure 89 o lightaugle places a light at a speci ed azimuth angle in the acy plane7 around the z aXis and elevation above the cry plane7 relative 245 Figure 89 Surface plotted using surfl to the origin It accepts these two angles in degrees as arguments o camlightissun arto lightangleexceptthattheangbsarerda ve to the camera position It also accepts arguments headlight to place the light at the camera position left to place the light left and up from the camera7 and right xcos0012pi ysin0012pi zzerossizex plot3xyZ grid xlabel x ylabel y zlabel z zsin001pi2 246 Figure 810 An illustration of azimuth and elevation gtgt xcos001pi2 gtgt yzerossizex gtgt hold Current plot held gtgt plot3xyz gtgt text100 azimuth gtgt text001 elevation The azimuth and elevation are illustrated in Figure 810 823 Camera Control You can alter your View of a 3D plot by changing your camera position Where the plotted object is the camera target 0 campos returns or sets the wyz coordinates of the camera position 247 o camtarget returns or sets the wyz coordinates of the camera tar get 0 camup returns or sets the camera up vector the vector that is used as the up direction 0 camproj returns or sets the projection which is either orthographic the default or perspective 0 camorbit rotates the camera position around the camera target by a speci ed horizontal and vertical angle both in degrees 0 campan is the opposite of camorbit rotating the camera target around the camera position 0 camzoom zooms the camera by a speci ed zoom factor a positive num ber which should be greater than 1 to zoom in and less than 1 to zoom out 824 Printing Graphs The print command can be used to print the current gure or Simulink model or save it to a le as an image Figures or models to be saved in var ious PostScript formats or on Microsoft Windows platforms as Meta les or bitmaps In addition a gure can be saved as a JPEG image a TIFF im age or a Portable Network Graphic image Most of the gures in this book were produced using the command print despc lename where despc speci es Encapsulated Color PostScript In combination with print printopt is an M le that can be used to indicate the default printer and device type The command itself returns two strings the rst indicating the print command that is to be used on the local system and the second becing the device option for the print command The orient command can be used to specify paper orientation accepting as its argument values such as landscape or portrait With no arguments it prints the current orientation 83 Handle Graphics Handle graphics functions are used to perform lower level graphics opera tions Each component of Matlab s GUI is an object which has a handle 248 This handle allows the object s properties to be retrieved or modi ed thus changing the display of the object Several of the previously discussed com mands either accept a handle as an argument or return a handle to some object 831 Object Hierarchy Graphics objects in Matlab are organized hierarchically The root object is the screen lts children are gure windows the highest level objects to which handles can be obtained Figure windows serve as containers for various objects including axes uimenus and uicontmls Axes as we have seen are used for plotting data Uimenus are used to implement menu options Uicontrols provide other GUI functionality and can have several styles such as checkboxes or listboxes 832 Figure Windows The following commands are used to work with gure windows 0 The figure command creates a new gure window and returns its handle It also accepts an integer argument which causes Matlab to create a Figure with that number as its handle if it does not already exist The gure whether new or not becomes the current gure 0 gcf returns a handle to the current gure for use with other com mands o clf clears the current gure 0 shg brings the current window to the foreground 0 close closes the current or speci ed gure 833 Axis Control The following commands are used to work with handles of axes objects 0 gca returns a handle to the current axes for use with other commands o axes returns a handle to the axes that it creates o subplot returns the handle of the new current axes that was indicated in its arguments Both subplot and axes can be passed a handle to make the axes with that handle the current axes 249 surf returns a handle to a surface object 834 Handle Graphics Objects The following other objects can be created with commands of the same name as the object line accepts vectors representing points in two or three dimensions and plots lines connecting those points on the current axes It returns the handle of the newly created line object patch creates a lled 2D or 3D polygon and adds it to the current axes returning a handle to the patch object It accepts vectors represent the w y and 2 if applicable coordinates of the vertices and an optional color speci cation rectangle adds a rectangle of a speci ed size at a speci ed position or creates a rectangle with curved edges image creates and returns a handle to an image object from a matrix Whose elements are interpreted as indices into the current colormap light creates and returns a handle to a light object for the current axes uicontrol creates a user interface control for the current gure Win dow or a speci ed gure Whose handle is passed as the rst argument and returns its handle uimenu creates a user interface menu for the current or speci ed gure Window uicontextmenu creates a user interface context menu which can be associated with another object The following commands are commonly used with graphics handles set accepts as arguments the handle of an object and a list of property name value pairs and modi es those properties of the speci ed object get accepts as arguments the handle of an object and displays its prop erty names and values An optional property name can be speci ed to retrieve just that property 250 o reset resets all properties except position of the speci ed object7 Whose handle is passed as the rst argument 0 delete removes a graphics object gtgt myaxesaxes myaxes 990011 gtgt x0012pi gtgt ysinx gtgt mylinelinexy myline 1000011 gtgt mylabelgetmyaxes XLabel mylabel 1010018 gtgt getmylabel Color 0 0 0 EraseMode normal Editing off Extent 345977 113411 0 0 FontAngle normal FontName Helvetica FontSize 10 FontUnits points FontWeight normal HorizontalAlignment center Position 349194 113743 173205 Rotation 0 String Units data 251 Interpreter tex VerticalAlignment cap BeingDeleted off ButtonDownFcn Children Clipping off Creatchn Deletchn BusyAction queue HandleVisibility off HitTest on Interruptible on Parent 990011 Selected off SelectionHighlight on Tag Type text UIContextMenu UserData U Visible on gtgt setmylabel String This is X gtgt setmylabel FontName Courier gtgt getmyline Color 0 0 1 EraseMode normal LineStyle LineWidth 05 Marker none MarkerSize 6 MarkerEdgeColor auto MarkerFaceColor none XData 1 by 63 double array YData 1 by 63 double array ZData U BeingDeleted off ButtonDownFcn 252 Children Clipping on Creatchn Deletchn BusyAction queue HandleVisibility on HitTest on Interruptible on Parent 990011 Selected off SelectionHighlight on Tag Type line UIContextMenu UserData U Visible on gtgt setmyline LineStyle gtgt type clickme function clickme xygetgcf CurrentPoint Z get point where mouse clicked xxy1 yxy2 Posgetgcf Position APosgetgca Position Z get coordinates relative to axes K as percentage of axes width and height xxAPos1Pos3APos3Pos3 yyAPos2Pos4APos4Pos4 XLimgetgca XLim YLimgetgca YLim Z express coordinates in grid units xxXLim2XLim1XLim1 yyYLim2YLim1YLim1 textxy Hey Stop that gtgt setmyaxes ButtonDownFcn clickme The behavior of clickme is illustrated in Figure 811 253 08 06 04 02 04 06 08 Hey Stop that Hey Stop that Hey Stop that Hey Stop that t t t t 4 t 1 2 4 5 6 This is K Figure 811 The behavior of the function clickme 254 84 Graphical User Interfaces in Matlab Matlab offers several commands for building GUl s These commands use handles to access user interface objects retrieving or modifying properties In particular menus and dialog boxes can easily be created and associated with callback functions or scripts to associate the user interface with un derlying functionality 841 Working with the Figure Window By default a gure Window has ve menus File Edit Tools Window and Help Also its title is Figure No 71 where n is some integer If you set a title it will be appended to the default title To remove the existing menus sethfigure Menubar none To remove the default title sethfigure NumberTitle off In both cases hf igure is the handle to the gure Window 842 Menus Menus and menu options are created using the uimenu command uimenu accepts as arguments an optional handle followed by an optional list of property namevalue pairs If no handle is given the current gure is as sumed If the handle belongs to a gure object a new menu for that gure is created Otherwise if it belongs to another menu object a new menu option for that menu is created 843 Menu Properties The following are commonly used menu properties 0 Accelerator is a character specifying the keyboard equivalent or short cut key for the menu item Typing CTRL and the character invokes the item on PC and UNIX platforms 0 Callback is the string that is executed by Matlab when the menu item is selected 0 Checked indicates Whether the menu item is checked 0 Enable is on when the item can be selected and off otherwise 255 o ForegroundColor is the text color of the menu item speci ed as a row vector of RGB values 0 Label is a string containing the label of the menu or menu item 0 Position is the relative position of the menu object Top level menus are numbered from left to right while menu items are numbered from top to bottom 0 Separator is on if the item includes a separating line above it 0 Children is an array of object handles to the menu s or menu item s submenus 0 Type is a read only property identifying the object as a uimenu o Visible when it is off causes the menu item to not be drawn 844 Callbacks The CallBack property is what actually makes menus useful When a menu option is selected the Matlab code contained in the Callback property of the menu option is executed The Callback property is an array of strings each string representing a Matlab statement Each such string must be enclosed in single quotes and the last character in the string must be a comma or semicolon except for the last string Recall that single quotes needed inside strings must be typed as two consecutive single quotes Scope and Callbacks It is essential to remember that code in a Callback property is executed in the toplevel workspace This is because the code is passed to Matlab s eval function to be executed Therefore if you set an object s Callback property from within a func tion you should not use that function s variables in the callback code Scripts vs Functions Given the behavior of callbacks is it better to use scripts or functions in callback code Scripts seem like a natural choice since code is executed in the top level workspace so all variables can easily be stored and accessed in a common 256 area On the other hand the workspace can become cluttered with variables and callback strings can become extremely complex Also scripts execute more slowly than functions since they must be recompiled each time they are executed Functions have the advantages that they keep the workspace uncluttered execute more rapidly than scripts and keep callback strings simple How ever function code executes within its own workspace Therefore variables de ned within the function cannot be accessed by other callback code and vice versa Workarounds There are some ways to make either functions or scripts simpler to use in callback code The function assignin can be called within a function to set a variable s value within the top level workspace Alternatively one can use the UserData property which all objects possess It can be set to any object and is intended to associate application speci c data with an object User Interface Controls In addition to menus user interface controls of various types can also be created to implement common Ul functionality The uicontrol function is used to create a user interface control The type of control is speci ed by setting the Style property of the control Push Buttons A push button such as an OK or Cancel button commonly seen in dialogs can be created by creating a uicontrol whose Style property is set to pushbutton The text in the button can be set via the String property It can be placed anywhere within its gure window by setting the Position property gtgt okbuttonuicontrolgcf Style pushbutton String DK Position 20 20 60 20 J Radio Buttons A radio button is commonly used to select one of a group of mutually ex clusive options It is created by creating a uicontrol with the Style set to 257 radiobutton The caption of the radio button is speci ed using the String property and the state cleared or selected is speci ed using the Value property usually 0 for cleared and 1 for selected You must enforce mutual exclusivity yourself clearing all other radio buttons with a group if one of them is selected C heck B oxes Check boxes are very similar to radio buttons except that they are typically used when more than one of a set of options may be selected To create a check box set the Style property equal to checkbox As with radio buttons set the Value property to O to clear the checkbox and to 1 to select it Static Text Boxes A static text box is used to add text to a Window that is not meant to be edited by the user Often it is used as a label for some other control in the Window A static text box can be created via uicontrol setting the Style property to text The String property represents the text to be placed Within the box The Position property must be set so that all of the text can be seen Editable Text Boxes An editable text box is used to allow the user to input a text string It can be created by creating a uicontrol with the Style property set to edit The String property represents the string that is currently in the text box The user may type more text into the box than is visible based on the value of the Position property List Boxes A list box is used to allow the user to select one or more options from a prede ned list of choices A list box is created using uicontrol with the Style property set to listbox The Min and Max properties indicate how many choices can be selected The user may select up to Max Min choices from the list The choices are speci ed via the String property with each choice separated by a vertical bar The indices of the selected choices are stored in the Value property as a row vector 258 gtgt htextuicontrolgcf Style text String Death byz Position 20 300 60 20 gtgt hlistuicontrolgcf Style listbox Min 0 Max 2 Position 80 280 100 40 String HanginglFiring SquadlStoninglCrucifixion Control Properties The following are commonly used properties of the various uicontrols 0 Style is a string that de nes the type of uicontrol object o BackgroundColor is the background color of the control 0 ForegroundColor is the text color of the control 0 String speci es the text in text boxes the label on push buttons radio buttons or check boxes For listboxes or editable text boxes this can be a cell array of strings a string matrix or a string with vertical bars separating items 0 HorizontalAlignment is the horizonal alignment of the label string which can be left center or right 0 FontName speci es the name of the font used to display the String property 0 FontSize speci es the font size 0 FontUnits speci es the units used by the FontSize property 0 FontAngle speci es the font slant eg italic o FontWeight speci es the font weight eg bold 0 Max is assigned to the Value property when a radio button or check box is selected It is also used in conjunction with Min to determine how many items can be selected in a list box lts default value is 1 0 Min is assigned to the Value property when a radio button or check box is cleared lts default value is O 259 0 Value is the current value of the uicontrol In particular it is used by radio buttons and checkboxes to indicate whether it is selected in which case Value is on or cleared off Text boxes edit boxes and push buttons do not use this property 0 Position is a row vector indicating the location of the lower left corner of the control relative to the lower left corner of the gure window and its width and height By default the values are interpreted as pixels 0 Units is the unit of measurement for the Position values 0 ListboxTop is the index of the topmost string displayed in a list box 0 Callback is the Matlab code executed when the control is activated ButtonDownFcn is the Matlab code executed when the mouse is clicked within a 5 pixel border of the control provided that it is enabled Enable is normally on indicating that the control can receive input It can be grayed by setting this property to off or simply disabled by setting it to inactive o Visible is on if the control is visible and off otherwise 0 Type is a read only property indicating the type of the object which in this case is uicontrol Utility Functions The following additional functions are useful for working with user interface objects 0 selectmoveresize can be speci ed as a ButtonDownFcn of an object so that when the object is clicked it can be interactively moved or resized thus changing its Position vector 0 setptr accepts a gure and a cursor name as arguments and sets the mouse pointer for that gure The help page on setptr lists the available cursor names 0 rotate accepts as arguments the handle of an object a direction in 3D speci ed either as a point or as angles in spherical coordinates and an angle through which the object should be rotated 260 refresh forces a given gure or the current gure if none is speci ed to be redrawn gcbo gcbf return handles to the current callback object and callback gure They can be used within callback code to access the object that is calling that code dragrect rbbox are helpful for dragging operations They can only be called if the mouse button is down so they should be used as ButtonDownFcns dragrect accepts an n X 4 matrix each row speci fying a rectangle and allows the mouse to drag all n rectangles with it rbbox accepts a rectangle and a point and allows the rectangle to be anchored at the point and resized It returns the nal rectangle makemenu simpl es the menu creation process allowing an entire set of menus and options to be speci ed in one call instead of separate calls for each menu and option It accepts a gure handle a matrix of strings for the menu labels and a matrix of strings for the callbacks umtoggle toggles the Checked property of a uimenu object and returns a 1 if the new status is on and 0 if it is off hidegui sets or retrieves the hidden state of an object which deter mines whether the object s handle shows up in the list of its parent object s children This command works with the HandleVisibility property which is off if the object s handle is hidden on if it is not and callback if its handle is only visible when callback code is exe cuting edtext is used as a ButtonDownFcn for a static text box allowing the text in the box to be changed by clicking the box ishandle returns 1 if its argument is the handle of an object and 0 otherwise uiwait uiresume waitfor are used to suspend or resume execu tion uiwait accepts a gure handle as input and waits until the gure is closed or until uiresume is called waitfor blocks execution until the handle passed to it is closed or until a property passed as an op tional second argument is changed or when that property assumes a certain value passed as an optional third argument waitfor is used to implement uiwait 261 o btngroup btnstate btnpress btndown btnup btnicon are used to create and manage a set of toolbar buttons 0 setuprop getuprop clruprop are used to create set retrieve and remove user de ned properties in gure and axes objects 0 textwrap wraps text strings so that they t in a given uicontrol GUI Tools Matlab offers a set of interactive tools that make it much easier to build a 0 guide 0 align o menuedit o propedit o cbedit 845 Dialog Boxes and Requesters Matlab offers several functions both low level and high level for creating dialogs used to display a message and accept user responses via push but tons and requesters used to obtain user input via the mouse and keyboard and pass that input to the function creating the requester 846 Dialogs A dialog box may be created using the dialog function which accepts a sequence of property namevalue pairs The key properties of dialogs are 0 The WindowStyle property which can be set to modal for a modal dialog thus disabling all other Matlab Windows until the dialog exits or normal for a non modal dialog o The Visible property which if set to off causes other Windows to be enabled even if the dialog is modal To alleviate the tedious chore of setting several properties for commonly used dialogs Matlab provides several high level functions for creating spe ci c types of dialogs 262 o msgbox displays a dialog with a given message and OK button An optional title may be supplied 0 helpdlg warndlg and errordlg are simlar to msgbox but include a help icon a warning icon and an error icon respectively 0 questdlg accepts a string representing a question and up to three labels for buttons indicating possible responses such as Yes No or Cancel 8 4 7 Requesters A typical requester may be created using the inputdlg function which accepts as arguments a cell array of prompt strings for the items requested a title string an optional array of integers specifying how many lines are expected for each input default is one for every input and an optional cell array of initial strings for each input default is the empty string A cell array of response strings is returned gtgt myname inputdlg Enter name Name Requester myname Jim Lambers gtgt namearray inputdlg First name Last name Name Requester namearray Jim Lambers List Dialogs A list dialog is a dialog consisting of a listbox an optional prompt string and gure title and two push buttons representing DK and Cancel A Select All push button may also be added A list dialog is created using the listdlg function which accepts a list of property namevalue pairs as arguments 263 listdlg properties Othe ListString is a cell array of strings for the listbox SelectionMode is either single or multiple the default ListSize is a row vector containing the Width and height in pixels of the listbox The default is 160 300 InitialValue is the vector of indices of the items in the listbox that are initially selected the default is 1 Name is the gure s title default is the empty string PromptString is the prompt string displayed above the listbox default is the empty string DKString is the string for the OK button the default is OK CancelString is the string for the Cancel button the default is Cancel uh is the height of the buttons in pixels the default is 18 fus is the frameuicontrol spacing in pixels default is 8 ffs is the frame gure sapcing in pixels default is 8 r Requesters The following commands create other requesters for obtaining commonly used data from the user uigetf ile and uiputf ile are used to obtain pathnames and lenames for opening and saving a le respectively They accept an optional lter string default is m an optional dialog title and an optional screen position The lename and directory are returned in that order uisetcolor is used to request a color from the user It accepts an ini tial color speci ed either as a row vector of RGB values or as a handle to an object in which case the object s Color or ForegroundColor property is used The output is an RGB vector for the selected color An optional title for the color requester can be speci ed uisetfont is used to set the font style for an object It accepts the handle of the object and an optional title for the font selection dialog as arguments 264 o axlimdlg uses inputdlg to build an axis limit requester o tabdlg builds a tabbed dialog box similar to the tabs on le folders 848 Creating a GUI in Matlab We will illustrate the process of creating a simple GUI including standard objects such as menus dialogs and requesters Our goal is to create a GUI that will allow a user to describe an ODE to Matlab and then solve it Requirements The goal of this GUI is to allow the user to describe and solve an ODE of the form dy a Ft7y7 No 30 81 where 3t is a scalar valued or vector valued function of t The user must be allowed to specify the function F the initial time to and the initial data 30 Also the user must be allowed to specify a nal time tf at which the solution is desired Functional Speci cation This GUI will do the following o It will provide menu options for entering the function F the initial and nal times to and tf and the initial data yo Each of these menu options will invoke requesters that will actually accept the data from the user In addition there will be a menu option to solve the ODE It must only be enabled if the ODE is completely speci ed A separate menu Options will provide options as to whether the solution should be plotted saved to the workspace or both These options will be checked if they are active By default the solution will be plotted If the user enters an initial time that is not later than the nal time an error dialog must be displayed and the user must be made to try again 265 0 To solve the ODE7 ode23 must be used 0 If the user elects to save the output from ode237 it must be stored in the variables t and y in the top level workspace function odesolveodefunctimesy0options Z write odefile fidfopen odefuncm w for j1zsizeodefunc1 fprintffid sn odefuncj end fclosefid Z set ode solver options if strcmpoptionsplot on outputfcn odeplot else outputfcn end odeoptsodeset Dutputhn outputfcn Z solve ode tyode23 odefunc timesy0 odeopts if strcmpoptionssave on K store data in workspace assignin base t t assignin base y y end if strcmpoptionsplot on K annotate plot title DDE solution xlabel t ylabel y end function odestudio hfigure figure sethfigure Menubar none sethfigure NumberTitle off sethfigure Name DDE Studio Version 10 266 hodemenuuimenuhfigure Label DDE hfuimenuhodemenu Label Specify dampydt Callback odefuncgetode optionssetoptodefunc options quotode setsolveoptionshsolve htuimenuhodemenu Label Set initial and final amptimes Callback timesgettimes optionssetopttimes options quottimes setsolveoptionshsolve hicuimenuhodemenu Label Set initial ampdata Callback y0getdata optionssetopty0 options quotdata setsolveoptionshsolve hsolveuimenuhodemenu Label ampSolve Enable off Callback solveodeodefunctimesy0options assignin base hsolve hsolve hquituimenuhodemenu Label Exit Callback close Separator on hoptmenuuimenuhfigure Label Dptions hplotuimenuhoptmenu Label Plot Solution Checked on Callback optionsplottoggleopt evalin base optionsplot onquot hsaveuimenuhoptmenu Label Save to Workspace Callback optionssavetoggleopt evalin base optionssavequotoff function y0getdata strinputdlg Enter initial values separated by spaces Enter initial data 2 if quotisemptystr y0str2numstr1 else 267 y0 end function ode getode odearr inputdlg Enter Fty below Enter dydt 10 function F odefilety if quotisemptyodearr ode odearr1 else ode end function timesgettimes done0 while done strtimes inputdlg Initial Time Final Time Enter Initial and Final Times 1 if quotisemptystrtimes times str2doublestrtimes1 str2doublestrtimes2 if times1 gt times2 errdlgerrordlg Final time must be later than initial time Error modal uiwaiterrdlg else done 1 end else times done 1 end end function optssetoptvaloptsfieldname if quotisemptyval optssetfieldoptsfieldname on end function setsolveoptshsolve if isfieldopts ode amp strcmpoptsode on amp 268 isfieldopts times amp strcmpoptstimes on amp isfieldopts data amp strcmpoptsdata on sethsolve Enable on end function result toggleopt hopt gcbo val gethopt Checked if quotisemptyval amp strcmpval on result off else result on end sethopt Checked result 85 Exercises 1 For this assignment you will be creating a simple GUI that will cre ate a gure window and add a menu with options for accepting the following input from the user 0 A string representing a function of one or two variables 0 Limits for the function s independent variables There will also be a menu option that will plot the given function evaluating it at data points determined by the prescribed limits Speci cally you will be writing the following four functions a function funcwindow This function does the following o Creates a new gure window 0 Sets these property values in the gure object i MenuBar None ii NumberTitle off iii Name Function Plotter o Creates a menu called Functions for the gure window 0 In the new menu creates the following options i Create 1variable function 269 b A O V Create 2variable function Set Limits initially disabled Plot Function initially disabled V Close ii iv 0 Sets the Callback properties for each of the menu options The Callback property is to be set as follows 0 For Close simply close the gure 0 For Create 1 or 2 variable function it should call getfunc with the argument 1 or 2 as appropriate and save the re turned string in the workspace If the string is not empty then the Set Limits menu option should be enabled The number of variables should also be saved in the workspace For Set Limits it should call getlimits with the number of variables previously chosen which should have been saved in the workspace when the function was created and save the output of getlimits in the workspace If the row vector returned by getlimits is not empty then Plot Function menu option should be enabled For Plot Function simply call plotfunc passing the limits and function string function sgetfuncnumvars This function accepts a number of variables 1 or 2 and creates an inputdlg The title of the dialog will be Enter Function The prompt will be Enter a function of x or Enter a function of x and y The string that the user types into the dialog must be returned in s function limitsgetlimitsnumvars This function also creates an inputdlg with the title Enter Depending on whether the number of variables is 1 or 2 either 2 or 4 prompts will be displayed for X Minimum X Maximum and ifapplicable Y Minimum and Y Maximum The strings returned by the dialog must be converted to doubles using the str2double function and returned as a row vector in limits Limits function plotfunc limits funcstr This function accepts a row vector of limits and a string repre senting a function of either one or two variables The number of 270 variables can easily by obtained from the length of limits if the length is 2 the function is assumed to be of one variable and if it is 4 then it is a function of two variables In the onevariable case a column vector of w values must be con structed ranging from the minimum w value to the maximum w value with spacing of 001 The function must then be evaluated at each of these points the results stored in a column vector y In the two variable case column vectors of w and y values must be constructed ranging between the prescribed limits in w and 3 again with spacing of 001 The function must then be evalated at each point x y the results stored in an m X 71 matrix 2 where m is the length of the vector of w values and n is the length of the vector of y values Then in either case the function must be plotted using plot in the onevariable case and plot3 in the two variable case The functions xlabel ylabel and zlabel must be used to label the axes with x y or z The plot must have the title Function plot In either case to evaluate the function you need to create an inline function object from the given string representing the function The inline function accepts the function string as the rst argument and optional arguments representing the indepen dent variables of the function in this case x or w and The default variable is 3 Variables if speci ed must be in single quotes 2 For this assignment you will be adding features to the ODE studio GUI presented earlier You will be changing some of the existing functions and adding two new ones You should NOT have to change toggleopt gettimes getdata or getode We will be adding the ability to accept from the user a description of an ODE that can be solved analytically using Matlab s symbolic toolbox For simplicity such an ODE must be for a scalar solution W a We will be changing the structure of the DDE menu as follows 0 The rst three menu options Specify dydt Set initial and final times and Set initial data will be moved 271 A U v A 0 You must create a new menu option under ODE called Enter numerical ODE and put the previously mentioned options under it Create another menu option under ODE called Enter symbolic ODE lt itself is a menu with three options Enter differential equation Enter initial conditions initially disabled and Enter plot limits After all of this is completed the ODE menu should have just four options Enter numerical ODE which is a menu with three choices Enter symbolic ODE also a menu with three choices Solve initially disabled and Exit To simplify things we will use a structure called ode that has six elds 2 odefunc times and y0 all have the same meaning as the corresponding variables from the original version They are simply being moved into this structure symode is a string that represents a symbolic ODE symic is a cell array of strings representing initial conditions for symode limits is a row vector with two elements initial and nal times for plotting a symbolic solution We could use times but we are keeping them separate to simplify matters else where Using this structure we will no longer need the function setopt so remove it Rather setsolve will accept as arguments this structure and hsolve unchanged from the original version Modify setsolve so that it behaves as follows If the elds odefunc times and y0 exist in the given struc ture and none are empty then enable hsolve It the elds symode and symic exist in the given structure and none are empty then enable hsolve Otherwise disable hsolve Modify odestudio as follows i ii At the beginning of the function use evalin to set all of the elds in the ode structure to the empty matrix D In the callback code for the menu options be sure that the output of the functions getode gettimes and getdata are stored in the ode structure 272 A 1 v A D V A r n V iii Make sure that throughout the callback code any references to setopt are removed and that setsolve is passed the correct arguments 21 Change the call to solveode so that it accepts only the ode and options structures as arguments We will discuss later how that function s behavior will change Add the following callback code for the menu options under Enter symbolic DDE i For Enter differential equation callafunction getsymode discussed below with no arguments Store the output in odegetsymode If this output is not empty then enable Enter initial conditions Call setsolve as per usual For Enter initial conditions call a function getsymic passing the ode structure as the argument The output must be stored in odesymic Call setsolve in the usual way For Enter plot limits call a function getlimits that takes no arguments Store the result in ode limits Modify the callback code for all options under Enter numerical DDE and Enter symbolic DDE as follows 0 When any of the options under Enter numerical DDE are used set all of the symbolic elds symode symic and limits to the empty matrix D 0 When any of the options under Enter symbolic DDE are used set all of the numerical elds odefunc times and y0 to the empty matrix D Write a new function getsymode that prompts for a single string that represents a symbolic ODE The prompt must be Differential equation for yt and the title of the requester must be Enter Symbolic DDE See Figure 812 for a screen shot of what the requester should look like Observe how a second order ODE is speci ed Write a new function getsymic that prompts for initial condi tions This function accepts the ode structure as its only argu ment This function is a little more complex since we must keep in mind that a differential equation of order 71 requires 71 initial conditions one for the solution 3t one for 3t etc Therefore we must 273 detect the order of the differential equation to determine how many prompts we need To detect the order keep in mind that in a string representing a symbolic ODE derivatives are denoted using a D Higher order derivatives are denoted by adding a digit after D representing the order of the derivative eg D2 for a second derivative We will assume that the order will be no higher than 9 Use the f ind function to obtain the indices of D within ode symode Since we are actually interested in the characters following these D s add one to all of these indices and extract the corresponding characters from odesymode To perform this extraction recall that if u is a vector and v is a row vector of indices then uv is a new vector formed from the elements at only those indices Let s be the string obtained by extracting just these characters The characters in s will either be digits representing higher order derivatives or they will be the letter y which indicates a rst derivative Find the largest digit in the string and that will be the order of the differential equation If there are no digits then we know that it is a rstorder equation Construct a cell array of n prompts where n is the order of the differential equation The rst prompt must be Initial condition for y the second must be Initial condition for Dy and all subsequent prompts must be Initial condition for Dny where n 23 up to n 71 Use inputdlg with these prompts and the title Enter Initial Condition Return the output of inputdlg as the output of this function See Figure 813 for a screen shot of what the requester should look like In this case the equation is of order 2 h Write a new function getlimits that prompts for two numeric values Initial Time and Final Time with the requester title Enter Plot Limits This function will be very similar to getlimits from Homework 5 only simpler It must return the empty matrix if the output of inputdlg is empty See Figure 814 for a screen shot of what the requester should look like i Modify odesolve as follows o It now must accept two arguments the ode and options structures 274 game OK mm m mm M an d iezantxx Mm mummy n musv m mw mam odeinnc Rwy 01 my 1m w mgmwcm wpxuuadya mmwmlmmww em n odeinnc mmw cm W km mu m hm wmm ca m m chaad 3 MW 0 mm mm m symodewwh m gym We WmthmmmmW Nan rmon synucvmll kg mu may and mm 46 a m smug aw mm M mun p 9 m as c 5m huh MW of diam 5mm 171anan m mm w x cyclcns 5m w cn my my son m m a WWQ an m mm y m n cyclcns we r mm mm 1m mm m gm 1 9m mme m m Ammwmonsmu m be w m p 9 hm 1 Wm m w m M asclvexauxm an mm mm 09mg mu mu my mm a ml m y e wan mm S mng iS oxanmmpbof whack pmmm wok Ne REM m mm M an nutan condltlmsmznuuytmn Ewan Ramada D tezylct 1mm menuoytmn ODE Opuuns ODE sulmmn y smt Figure 3 15 Plat of solution to symbuhc ODE Autoimmune Disease Definiti n Ehrlich referred to this phenomenon as horror autotoxiats specific adaptive immune response directed against self antigens with loss of tolerance usually peripheral not central triggers is usually unknown seed immune response involves both envi and genetic factors soil female predominance Autoimmunity requires a 10s of selftolerance Ty 0 t pes of tolerance 0 central th mus and bone marro peripheral Human Autoimmune D seases Organ Non gpeci c Diseases 0 SLE systemic lupus erythematosus 0 RA rheumatoid arth Autoimmune Disease Characteristics remi ions and exacerbations organ speci c or organ non speci c persistence of antigen due to lack of clearance tissue lamage is produced by an igen speci c cy1otos T cells CD8 antiuennon speci c NK cells and macrophage immune complexes autoantibodies andor granulocytes Possible Pathogenic Defects Human Autoimmunity Multiple gene e inv 39 l in human autoimmune disease eg IDDM type I especial nvolving the MHC con bute in an additive or syner 0 these polygenic diseases Important individual role 0 39ed in different path types of self antigens Human Autoimmune Diseases Organ Spec L Diseases Central nervou stem multiple sclero s Thyroid Grave asethyrotoxicosis Hashimoto s th Platelets ITP idiopathic tln39ombocy10penic purpura Glomerular basement membrane Goodpasture s syndrome RED VI DISEASE THAT BAI HJSS mans Human Autoimmune Di 9 sum Lupus Ermuemmosus 1SLE mic Lupl 39y1llematosus 12 Fmvnra 39 e aid Emirnmmnlal F x S Sym Fnssib mu sewn sum Ea g i Immune umpleus Systemir Lupus En lemzmsus Phunllennd u39 51min Hummus Haw dn Auribndies mun 39 Human Autnimmune Disease dmnuhy m mllulixpunn39 39mu u nn xk s uu uquot nl eplux hum uuu up I39meon mummymu u mum xelyldmliz rm unis Bind u snluhk tannin Immune we Bind u n my 1m an gummu rum mg mmpluesegDNA Cnmylemem Pathways in SLE f mm mm mum am a ma mm I39mny Tummum edinme ma 1 1 ma 1 my manual a Humall Autoimmune Diseases Rheumamid arthritis Rlleumzmid ardu39lris svmmm mm mmquot WWW 1Wquot W Rheumatoid Am I mamI mum anmm FnSSiME Mgrllanisms fur um Ma Ma datu hed A 39 Y um um whammy mm l m d mnlemlar mmur an m m quot 2quot 392f quot x iy mak rn mm mm ar u nngenir musEs p eranrigens R1 quot quotl A39 u Rheumatoid arthrit39 ruses musing Juint Inflammation Possible 9 mum ms in Humans I g nibeiizi m tupiasmzi zu vnvirus B19 EB virus zu39bnvin lipnpul hzu39ide batteriai tell Her 1 5e hepatitis B and EB I ll 1 eptidng Rheumatoid Ami is iiytuphsm is uvcnvusun mrscn Human Autoimmune Dis ease NlnIDIENk lmmlmn Ankylnsing pnnrlylit is VulnhnWrumnn mt llamamm mum41 t humpimmu Hlunan Autoimmune Disease Human A1110immlln D ea e M astheniil Gravis Multiple Stlernsis LECTURE 8 Part II Continuity of Functions 8 Introduction 10 min Consider the following function de ned for all real I 1 if I gt 0 fri 0 if zgo The graph of f has a jump at a which occurs immediately to the left of a This intuitive assertion can be investigated by taking the rightsided limit of f at a 0 We nd that although 1 lies in the domain of f the limit at a is different from the actual value of the function at 1 However no such jump occurs to the right of a and we nd 133 fltzgt fltagt Other cases are possible eg if zgt0 fz 71 if zlt0 10 if 10 About each of them we can ask the following questions 0 Does the left right sided limit exist o If so does that limit equal the value of the function at a A particularly useful case is that of a function without jumps or improper limits on either side of a We discuss this case in the next section 9 Continuity of a Function at a Point 5 min Throughout this section suppose the domain of a function f includes an open interval 11zz and suppose a point 1 lies in that interval De nition The function f is said to be ghtecontz39nuous at a if the rightsided limit of f at 1 exists an equals f aZ hm fltzgt fltagt z a Leftcontinuity of f at a is de ned analogously De nition The function f is said to be continuous at a if f is both rightcontinuous and leftcontinuous at a The latter de nition can be stated directly in terms of limits as follows De nition The function f is said to be continuous at a if lim f I f a z a Continuous functions have a number of powerful properties useful for applications 10 Elementary Examples 15 min Below k denotes a nonnegative integer b a positive real number and c an arbitrary real number The following functions are continuous at all 1 except where noted otherwise 0 fzc fzx fzczk fz1z except atz0 fz positive branch except at z lt 0 o M fxsinz fzcosz fz logbz for allxgt 0 fzbr 11 Algebraic Properties of Continuity 5 min Continuity is preserved by addition7 multiplication division by a nonzero quantity7 composition 12 Continuity of a Function on a Closed Interval 5 min De nition Suppose a and b are real numbers such that a lt b By a closed interval with endpoints a and b we mean the collection of all points z satisfying a lt I g 12 Such an interval is denoted by 11 De nition A function f is said to be continuous on the closed interval 112 if the following conditions are ful lled o the interval 11 is contained in the domain of f o f is continuous on the open interval lab o f is rightcontinuous at a and leftcontinuous at 12 Exercise Give an example of a function continuous at every point in lo l7 but not continuous on the closed interval 01 Hint39 See the example in the section on Improper OneSided Limits 13 The Intermediate Zero Theorem and Its Applications 131 Local Positivity Rule 5 min IF a function f is de ned on an interval laiR aR and is continuous and positive at 1 THEN a has a neighborhood a 7 611 6 on which f is positive7 ie gt 0 for all z in a7 6a6 Veri cation best understood by drawing a picture Take an 6 so small that the open interval fa 7 e fa e does not contain 07 ie that fa7e gt 0 Since f is continuous7 the point a has a rightsided neighborhood la a6 mapped by f into fa7e7 fa e It follows that all values of f on the interval laa6 are gt fa7e gt 07 hence positive The Physics of Music Physics 15 Insfrucfar David Kirkby Universify of California Irvine dkirkby uciedu Misceiianeuus mm 01 hamtwmk 2 nwmgt m was my Lecture 8 Perceived pm uf epuremne Absuiuie pm Midierm review Hamtwmk m m b mm m u Ymsdnys imam m m m mnmm mew Nw 011 hams mm Mm WNW eviewquecmre39l Percepnun ufPiich fur Pure Tunes Wmquot usamd s mm m m dtptnds mas iyan n5 Voumd pm i pummymnmm bym quotmm mm mum m 01 me my a mum mm bynsamd mm bands mm m in MM mm m W basin mmnmm quotmi men n spans 0 apart mm Fquot Px z ym quotquot5 7quot st quot quotquot 5W Mu hwwwwuvmmmng enigma mayhem whim Maw WWW meniwzipiuxmusiza am Awnwmy whmn mm Mum mm a may we is quot9 mm mm mm mmm em v mm w W m emes mm m We we hm e m amma by h mm mng and mm 225 mm Pereepnun mm m esiymnw Wm quotm g A m mm nndA bu haw1mtiyzmwumshnguihbnwun emf mm mneehmwmw MP W A AA A we aw 2 m A x x x wwwmqmm mm WP m lnnn H1 cm 3 H1 A A x aw 6 m x A A 3 Ft mm W M We mm whnhn m mm m cm 5 M A a A a wusmmghnmBanmm imhsum w mm W A BAA Q mnzammm my AH AA A A0 h u M am 7 H B n we pm WW a I bnwun m ams mm 5 W V 2 E E N aw in m x A A x The Physics of Music Physics 15 UniversiTy of California Irvine sensory sTimuli Than can be recognized is The iusT noTiceabledi erence JND or difference limen The JND varies wiTh The frequency of a pure Tone in The same way as The widTh of The criTical band suggesTing ThaT vibraTions of basilar membrane play an imporTanT role The psychophysical Term for The smallesT difference in Source The Science of Soundquot Fig 510 Rossing Moore amp Wheeler 3rd ed InsTrucTor David Kirkby dkirkbyuciedu Physics of Music LecTure 8 D Kirkby An average person39s JND aT 1000 Hz The frequency used in The lasT demonsTraTion is 4 5 Hz If you have This average abiliTy To disTinguish piTches you goT abouT 2 ouT of 4 correcT sTarTing from group 7 The JND is abouT 130Th of a criTical band or abouT 112 of a SemiTone above 1000 Hz The Typical hearing range is covered by abouT 5000 JNDS Compare wiTh vision The visible specTrum is covered by abouT 128 JNDS Does This mean you can only disTinguish 128 differenT colors Physics of Music LecTure 8 D Kirkby 8 depend on iTs pressure level Signal ll IgourceAudiToryDemonsTraTions 12 1000 2000 3000 4000 Hz piTch Than The quieT Tone in each case Perceived PiTch and Pressure Level How does your percepTion of The piTch of a pure Tone FirsT calibraTe The volume using This 200 Hz reference quotJ SourceAudiToryDemonsTraTions12 r quot HouTsmaRossingWagenaars IPO NIUASA ouTsma Rosslng Wagenacrs 1P0 NIUASA NexT compare The piTch of The sounds in each of These 6 quieT loud Tone pairs of differenT frequencies 200 500 Record wheTher The loud Tone sounds higher or lower in Physics of Music LecTure 8 D Kirkby MosT people find ThaT perceived piTch increases wiTh pressure level aT high frequencies buT decreases aT low frequencies High frequency C U t a 8 True piTch gt 396 Low frequency 8 A Sound InTensiTy Physics of Music LecTure 8 D Kirkby 10 idenTify iTs piTch principle has a welldefined piTch Is ThaT enough C C 65 y l g SourceAudiToryDemonsTraTions 13 a H Sound39s piTch Perceived PiTch and Sound DuraTion How long does a sound have To lasT in order for you To LisTen To These examples of pure Tones of 300 1000 3000 Hz of increasing duraTion 1 2 4 8 16 32 64 128 A single cycle of 01000 Hz sound lasTs only 1 ms buT in ouTsma Rossing Wagenaars IPO NIUASA How many cycles are required To esTablish a sense of The Physics of Music LecTure 8 D Kirkby AbsoluTe PiTch AbsoluTe piTch or perfecT piTch is The abiliTy To recognize or produce a parTicular piTch wiThouT using a reference Tone Compare wiTh vision mosT people can recognize The specTral color red The excepTion are The approximaTely 2 of The populaTion mosle male ThaT are color blind How many people can recognize a middle C in The same way This is a very rare capabiliTy ThaT less Than 1 person in 10 000 has If you Think you mighT be one of Them Try This online Test Physics of Music LecTure 8 D Kirkby 12


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Kyle Maynard Purdue

"When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the I made $280 on my first study guide!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.