Lecture note Data visualization - Chapter 30
Số trang: 32
Loại file: pptx
Dung lượng: 2.02 MB
Lượt xem: 2
Lượt tải: 0
Xem trước 4 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
This chapter presents the following content: Cubic spline interpolation, multidimensional interpolation, curve fitting, linear regression, polynomial regression, the polyval function, the interactive fitting tools, basic curve fitting, curve fitting toolbox, numerical integration.
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 30Lecture30RecapCubicSplineInterpolationMultidimensionalInterpolationCurveFitting LinearRegression PolynomialRegression ThePolyvalFunction TheInteractiveFittingTools BasicCurveFittingCurveFittingToolBox NumericalIntegration ExampleHere’sanotherexample,usinga functionhandleandananonymous function,insteadofdefiningthe functioninsidesinglequoteFirstdefineananonymous functionforathirdorder polynomial fun_handle=@(x)x.^3+20*x.^2 5Nowplotthefunction,toseehow itbehaves.TheeasiestapproachisExampleContinued….SolvingDifferentialEquationNumericallyContinued….Eachsolverrequiresthefollowingthreeinputsasa minimum: Afunctionhandletoafunctionthatdescribesthefirst orderdifferentialequationorsystemofdifferential equationsintermsoftandy Thetimespanofinterest AninitialconditionforeachequationinthesystemThesolversallreturnanarrayoftandyvalues: [t,y]=odesolver(function_handle,[initial_time,final_time], [initial_cond_array])FunctionHandleInputContinued….SolvingtheProblemContinued….Continued….Whentheinputfunctionorsystemoffunctionsisstored inanMfile,thesyntaxisslightlydifferentThehandleforanexistingMfileisdefinedas @m_file_nameTosolvethesystemofequationsdescribedintwofunwe usethecommand ode45(@twofun,[1,1],[1,1])Thetimespanofinterestisfrom1to1,andtheinitial conditionsareboth1SolvingHigherOrderDifferentialEquationsContinued….NowallweneedtodoiscreateanMfilefunctiontouse inoneoftheodesolversThefunctionshouldhavetwoinputs,whicharetypically calledtandyThevariabletistheindependentvariable,andthe variableyisanarrayofdependentvariablesInthisexampley(1)correspondstotheyusedinthe handformulation,andy(2)correspondstozThefunctioncontainingthesystemofequationsshould looklikethis: functiondydt=twoeq(t,y)Continued….OncethesystemofequationsisdefinedinafunctionM fileitisavailabletouseasinputtoanodesolverForexample:iftherangeoftimeisdefinedas1to+1 andtheinitialconditionsaredefinedasy=0andz=0, thenthecommandbecomes ode45(@twoeq,[1,1],[0,0])whichgivestheresultsAproblemwherethestartingvaluesareknowniscalled aninitialvalueproblemBoundaryValueProblemsbvp4cfunctionisusedtosolveboundaryvalueproblemsThebvp4cfunctionrequiresthreeinputs: Afunctionhandletothesystemofode’stobesolved Afunctionhandletoafunctionthatsolvesfortheresidual valuesofthefunction AsetofguessesfortheinitialconditionsContinued….Thefirstfunctionhandleisexactlythesameasweused fortheodesolversetoffunctionsItshouldcontaintheequationsforthederivativesof interestandtheresultsmustbeacolumnvectorTosolvetheproblemaguessismadefortheinitialvalue ofallthederivatives,thentheprogramcheckstoseehow itdidbycomparingthecalculatedboundaryvalueswith theactualvaluesForexample,if: att=1,y=0and att=1,y=3
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 30Lecture30RecapCubicSplineInterpolationMultidimensionalInterpolationCurveFitting LinearRegression PolynomialRegression ThePolyvalFunction TheInteractiveFittingTools BasicCurveFittingCurveFittingToolBox NumericalIntegration ExampleHere’sanotherexample,usinga functionhandleandananonymous function,insteadofdefiningthe functioninsidesinglequoteFirstdefineananonymous functionforathirdorder polynomial fun_handle=@(x)x.^3+20*x.^2 5Nowplotthefunction,toseehow itbehaves.TheeasiestapproachisExampleContinued….SolvingDifferentialEquationNumericallyContinued….Eachsolverrequiresthefollowingthreeinputsasa minimum: Afunctionhandletoafunctionthatdescribesthefirst orderdifferentialequationorsystemofdifferential equationsintermsoftandy Thetimespanofinterest AninitialconditionforeachequationinthesystemThesolversallreturnanarrayoftandyvalues: [t,y]=odesolver(function_handle,[initial_time,final_time], [initial_cond_array])FunctionHandleInputContinued….SolvingtheProblemContinued….Continued….Whentheinputfunctionorsystemoffunctionsisstored inanMfile,thesyntaxisslightlydifferentThehandleforanexistingMfileisdefinedas @m_file_nameTosolvethesystemofequationsdescribedintwofunwe usethecommand ode45(@twofun,[1,1],[1,1])Thetimespanofinterestisfrom1to1,andtheinitial conditionsareboth1SolvingHigherOrderDifferentialEquationsContinued….NowallweneedtodoiscreateanMfilefunctiontouse inoneoftheodesolversThefunctionshouldhavetwoinputs,whicharetypically calledtandyThevariabletistheindependentvariable,andthe variableyisanarrayofdependentvariablesInthisexampley(1)correspondstotheyusedinthe handformulation,andy(2)correspondstozThefunctioncontainingthesystemofequationsshould looklikethis: functiondydt=twoeq(t,y)Continued….OncethesystemofequationsisdefinedinafunctionM fileitisavailabletouseasinputtoanodesolverForexample:iftherangeoftimeisdefinedas1to+1 andtheinitialconditionsaredefinedasy=0andz=0, thenthecommandbecomes ode45(@twoeq,[1,1],[0,0])whichgivestheresultsAproblemwherethestartingvaluesareknowniscalled aninitialvalueproblemBoundaryValueProblemsbvp4cfunctionisusedtosolveboundaryvalueproblemsThebvp4cfunctionrequiresthreeinputs: Afunctionhandletothesystemofode’stobesolved Afunctionhandletoafunctionthatsolvesfortheresidual valuesofthefunction AsetofguessesfortheinitialconditionsContinued….Thefirstfunctionhandleisexactlythesameasweused fortheodesolversetoffunctionsItshouldcontaintheequationsforthederivativesof interestandtheresultsmustbeacolumnvectorTosolvetheproblemaguessismadefortheinitialvalue ofallthederivatives,thentheprogramcheckstoseehow itdidbycomparingthecalculatedboundaryvalueswith theactualvaluesForexample,if: att=1,y=0and att=1,y=3
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