Lecture note Data visualization - Chapter 19
Số trang: 28
Loại file: pptx
Dung lượng: 900.38 KB
Lượt xem: 2
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
In this lecture we learned about: Checking an algorithm analysis, limitations of big-oh analysis, matlab environment, command window, command history, workspace window, current folder window, document window.
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 19Lecture19RecapCheckinganAlgorithmAnalysisLimitationsofBigOhAnalysisMATLABEnvironmentCommandWindowCommandHistoryWorkspaceWindowCurrentFolderWindowDocumentWindowGraphicsWindowThegraphicswindowlaunchesautomaticallywhen requesttoagraphismadeTodemonstratethisfeature,firstcreateanarrayofx values: x=[12345];Nowcreatealistofyvalues: y=[1020304050];Tocreateagraph,usetheplotcommand: plot(x,y)GraphicWindowEditWindowToopentheeditwindow,chooseFilefromthemenubar, thenNew,and,finally Script(File>New>Script)Thiswindowallowstotypeandsaveaseriesof commandswithoutexecutingthemEditwindowcanalsobeopenedbytypingeditatthe commandpromptorbyselectingtheNewScriptbutton onthetoolbarStartButtonThestartbuttonislocatedinthelowerlefthandcornerof theMATLABwindowItoffersalternativeaccesstothevariousMATLAB windows,aswellastothehelpfunction,Internet products,demosandMATLABtoolboxesToolboxesprovideadditionalMATLABfunctionalityfor specificcontentareasThesymbolictoolboxinparticularishighlyusefulto scientistsandengineersMatricesinMATLABThebasicdatatypeusedinMATLABisthematrixAsinglevalue,calledascalar,isrepresentedasa1X1 matrixAlistofvalues,arrangedineitheracolumnorarow,isa onedimensionalmatrixcalledavector.Atableofvaluesisrepresentedasatwodimensional matrixMATLABcanhandlehigherorderarrays.Thetermsmatrixandarrayareusedinterchangeablyby MATLABusers,eventhoughtheyaretechnicallyContinued….ScalarOperationsMATLAB®handlesarithmeticoperationsbetweentwo scalarsmuchasdoothercomputerprogramsandeven calculatorContinued….Thecommand a=1+2shouldbereadas“aisassignedavalueof1plus2,”whichistheadditionoftwoscalarquantities.Asingleequalssign(=)iscalledanassignmentoperator inMATLABTheassignmentoperatorcausestheresultofcalculations tobestoredinacomputermemorylocationTheassignmentoperatorissignificantlydifferentfroman equality.ConsiderthestatementContinued….Theassignmentstatementissimilartothefamiliar processofsavingafileWhenawordprocessingdocumentissavedatfirst,a nameisassignedtoitSubsequently,afterchangeshavebeenmade,fileis resaved,butstillassigningitthesamenameThefirstandsecondversionsarenotequal:justanew versionofdocumenthavebeenassignedtoanexisting memorylocationOrderofOperationsInallmathematicalcalculations,itisimportantto understandtheorderinwhichoperationsareperformedMATLABfollowsthestandardalgebraicrulesforthe orderofoperation: Firstperformcalculationsinsideparentheses,workingfrom theinnermostsettotheoutermost Next,performexponentiationoperations Thenperformmultiplicationanddivisionoperations, workingfromlefttoright Finally,performadditionandsubtractionoperations,ExampleConsiderthecalculationsinvolvedinfindingthesurface areaofarightcircularcylinderThesurfaceareaisthesumoftheareasofthetwocircular basesandtheareaofthecurvedsurfacebetweenthemIfwelettheheightofthecylinderbe10cmandtheradius 5cm,thefollowingMATLABcodecanbeusedtofind thesurfacearea: radius=5; height=10; surface_area=2*pi*radius^2+2*pi*radius*height OrderofOperationsContinued…ArrayOperationsUsingMATLABasaglorifiedcalculatorisfine,butits realstrengthisinmatrixmanipulationsThesimplestwaytodefineamatrixistousealistof numbers,calledanexplicitlistThecommand x=[1234]returnstherowvector x=1234Anewrowisindicatedbyasemicolon,soacolumnContinued….Acomplicatedmatrixmighthavetobeenteredbyhand, evenlyspacedmatricescanbeenteredmuchmorereadilyThecommand b=1:5andthecommand b=[1:5]areequivalentstatementsBothreturnarowmatrixb=12345Continued….Tocalculatethespacingbetweenelements,thelinspace commandisusedSpecifytheinitialvalue,thefinalvalue,andhowmany totalvaluesyouwantForexample, d=linspace(1,10,3)returnsavectorwiththreevalues,evenlyspacedbetween1and10: d=15.510Continued….Logarithmicallyspacedvectorscanbecreatedwiththe logspacecommand,whichalsorequiresthreeinputsThefirsttwovaluesarepowersof10representingthe initialandfinalvaluesinthearrayThefinalvalueisthenumberofelementsinthearrayThus, e=logspace(1,3,3)returnsthreevalues: e=101001000MatrixAdditionwithScalarMatricescanbeusedinmanycalculationswithscalarsIfa=[123],wecanadd5toeachvalueinthematrix withthesyntax b=a+5whichreturns b=678ThisapproachworkswellforadditionandsubtractionMultiplicationinMatrixInmatrixmathematics,themultiplicationoperator(*)has aspecificmeaningBecauseallMATLABoperationscaninvolvematrices, weneedadifferentoperatortoindicateelementby elementmultiplication.Thatoperatoris.*Forexample:a.*bresultsin element1ofmatrixabeingmultipliedbyelement1of matrixb ...
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 19Lecture19RecapCheckinganAlgorithmAnalysisLimitationsofBigOhAnalysisMATLABEnvironmentCommandWindowCommandHistoryWorkspaceWindowCurrentFolderWindowDocumentWindowGraphicsWindowThegraphicswindowlaunchesautomaticallywhen requesttoagraphismadeTodemonstratethisfeature,firstcreateanarrayofx values: x=[12345];Nowcreatealistofyvalues: y=[1020304050];Tocreateagraph,usetheplotcommand: plot(x,y)GraphicWindowEditWindowToopentheeditwindow,chooseFilefromthemenubar, thenNew,and,finally Script(File>New>Script)Thiswindowallowstotypeandsaveaseriesof commandswithoutexecutingthemEditwindowcanalsobeopenedbytypingeditatthe commandpromptorbyselectingtheNewScriptbutton onthetoolbarStartButtonThestartbuttonislocatedinthelowerlefthandcornerof theMATLABwindowItoffersalternativeaccesstothevariousMATLAB windows,aswellastothehelpfunction,Internet products,demosandMATLABtoolboxesToolboxesprovideadditionalMATLABfunctionalityfor specificcontentareasThesymbolictoolboxinparticularishighlyusefulto scientistsandengineersMatricesinMATLABThebasicdatatypeusedinMATLABisthematrixAsinglevalue,calledascalar,isrepresentedasa1X1 matrixAlistofvalues,arrangedineitheracolumnorarow,isa onedimensionalmatrixcalledavector.Atableofvaluesisrepresentedasatwodimensional matrixMATLABcanhandlehigherorderarrays.Thetermsmatrixandarrayareusedinterchangeablyby MATLABusers,eventhoughtheyaretechnicallyContinued….ScalarOperationsMATLAB®handlesarithmeticoperationsbetweentwo scalarsmuchasdoothercomputerprogramsandeven calculatorContinued….Thecommand a=1+2shouldbereadas“aisassignedavalueof1plus2,”whichistheadditionoftwoscalarquantities.Asingleequalssign(=)iscalledanassignmentoperator inMATLABTheassignmentoperatorcausestheresultofcalculations tobestoredinacomputermemorylocationTheassignmentoperatorissignificantlydifferentfroman equality.ConsiderthestatementContinued….Theassignmentstatementissimilartothefamiliar processofsavingafileWhenawordprocessingdocumentissavedatfirst,a nameisassignedtoitSubsequently,afterchangeshavebeenmade,fileis resaved,butstillassigningitthesamenameThefirstandsecondversionsarenotequal:justanew versionofdocumenthavebeenassignedtoanexisting memorylocationOrderofOperationsInallmathematicalcalculations,itisimportantto understandtheorderinwhichoperationsareperformedMATLABfollowsthestandardalgebraicrulesforthe orderofoperation: Firstperformcalculationsinsideparentheses,workingfrom theinnermostsettotheoutermost Next,performexponentiationoperations Thenperformmultiplicationanddivisionoperations, workingfromlefttoright Finally,performadditionandsubtractionoperations,ExampleConsiderthecalculationsinvolvedinfindingthesurface areaofarightcircularcylinderThesurfaceareaisthesumoftheareasofthetwocircular basesandtheareaofthecurvedsurfacebetweenthemIfwelettheheightofthecylinderbe10cmandtheradius 5cm,thefollowingMATLABcodecanbeusedtofind thesurfacearea: radius=5; height=10; surface_area=2*pi*radius^2+2*pi*radius*height OrderofOperationsContinued…ArrayOperationsUsingMATLABasaglorifiedcalculatorisfine,butits realstrengthisinmatrixmanipulationsThesimplestwaytodefineamatrixistousealistof numbers,calledanexplicitlistThecommand x=[1234]returnstherowvector x=1234Anewrowisindicatedbyasemicolon,soacolumnContinued….Acomplicatedmatrixmighthavetobeenteredbyhand, evenlyspacedmatricescanbeenteredmuchmorereadilyThecommand b=1:5andthecommand b=[1:5]areequivalentstatementsBothreturnarowmatrixb=12345Continued….Tocalculatethespacingbetweenelements,thelinspace commandisusedSpecifytheinitialvalue,thefinalvalue,andhowmany totalvaluesyouwantForexample, d=linspace(1,10,3)returnsavectorwiththreevalues,evenlyspacedbetween1and10: d=15.510Continued….Logarithmicallyspacedvectorscanbecreatedwiththe logspacecommand,whichalsorequiresthreeinputsThefirsttwovaluesarepowersof10representingthe initialandfinalvaluesinthearrayThefinalvalueisthenumberofelementsinthearrayThus, e=logspace(1,3,3)returnsthreevalues: e=101001000MatrixAdditionwithScalarMatricescanbeusedinmanycalculationswithscalarsIfa=[123],wecanadd5toeachvalueinthematrix withthesyntax b=a+5whichreturns b=678ThisapproachworkswellforadditionandsubtractionMultiplicationinMatrixInmatrixmathematics,themultiplicationoperator(*)has aspecificmeaningBecauseallMATLABoperationscaninvolvematrices, weneedadifferentoperatortoindicateelementby elementmultiplication.Thatoperatoris.*Forexample:a.*bresultsin element1ofmatrixabeingmultipliedbyelement1of matrixb ...
Tìm kiếm theo từ khóa liên quan:
Data visualization Lecture note Data visualization Data structures Data Visualization with C Data visualization with matlab Effective graphical displayGợi ý tài liệu liên quan:
-
Trực quan hóa dữ liệu: Vai trò & thử thách
10 trang 37 0 0 -
Ebook Eloquent JavaScript - A modern introduction to programming: Part 1
199 trang 32 0 0 -
Ebook Management support systems: Part 2 - Dr. Kamlesh Lakhwani
136 trang 31 0 0 -
Lecture Introduction to computing systems (2/e): Chapter 19 - Yale N. Patt, Sanjay J. Patel
28 trang 30 0 0 -
Ebook Introduction to algorithms (3rd edition)
1313 trang 27 0 0 -
Lecture Data Structures: Lesson 38
71 trang 26 0 0 -
Lecture Data structures and algorithms: Chapter 1 - Introduction
41 trang 26 0 0 -
Lecture note Data visualization - Chapter 22
21 trang 24 0 0 -
Lecture Data Structures: Lesson 41
18 trang 23 0 0 -
335 trang 23 0 0