Lecture note Data visualization - Chapter 30

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. | Lecture note Data visualization - Chapter 30 Lecture 30 Recap 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 Example Here s another example using a function handle and an anonymous function instead of defining the function inside single quote First define an anonymous function for a third order polynomial fun_handle @ x x. 3 20 x. 2 5 Now plot the function to see how it behaves. The easiest approach is Example Continued . Solving Differential Equation Numerically Continued . Each solver requires the following three inputs as a minimum A function handle to a function that describes the fi rst order differential equation or system of differential equations in terms of t and y The time span of interest An initial condition for each equation in the system The solvers all return an array of t and y values t y odesolver function_handle initial_time final_time initial_cond_array Function Handle Input Continued . Solving the Problem Continued . Continued . When the input function or system of functions is stored in an M file the syntax is slightly different The handle for an existing M file is defined as @m_file_name To solve the system of equations described in twofun we use the command ode45 @twofun 1 1 1 1 The time span of interest is from 1 to 1 and the initial conditions are both 1 Solving Higher Order Differential Equations Continued . Now all we need to do is create an M file function to use in one of the ode solvers The function should have two inputs which are typically called t and y The variable t is the independent variable and the variable y is an array of dependent variables In this example y 1 corresponds to the y used in the hand formulation and y 2 corresponds to z The function containing the system of equations should look like this function dydt twoeq t y Continued . Once the

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.