TAILIEUCHUNG - Lecture Data visualization - Chapter 29
The main contents of the chapter consist of the following: The relational algebra, unary relational operations, relational algebra operations from set theory, binary relational operations, ER-to-Relational mapping algorithm, mapping EER model constructs to relations. | Lecture 29 Recap Summary of Chapter 6 Interpolation Linear Interpolation Cubic Spline Interpolation Connecting data points with straight lines probably isn’t the best way to estimate intermediate values, although it is surely the simplest A smoother curve can be created by using the cubic spline interpolation technique, included in the interp1 function. This approach uses a third-order polynomial to model the behavior of the data To call the cubic spline, we need to add a fourth field to interp1 : interp1(x,y,,'spline') This command returns an improved estimate of y at x = : ans = The cubic spline technique can be used to create an array of new estimates for y for every member of an array of x -values: new_x = 0:; new_y_spline = interp1(x,y,new_x,'spline'); A plot of these data on the same graph as the measured data using the command plot(x,y,new_x,new_y_spline,'-o') results in two different lines Multidimensional Interpolation Suppose there is a set of data z that depends on two variables, x and y . For example Continued . In order to determine the value of z at y = 3 and x = , two interpolations have to performed One approach would be to find the values of z at y = 3 and all the given x -values by using interp1 and then do a second interpolation in new chart First let’s define x , y , and z in MATLAB : y = 2:2:6; x = 1:4; z = [ 7 15 22 30 54 109 164 218 403 807 1210 1614]; Now use interp1 to find the values of z at y = 3 for all the x -values: new_z = interp1(y,z,3) returns new_z = Finally, since we have z -values at y = 3, we can use interp1 again to find z at y = 3 and x = : new_z2 = interp1(x,new_z,) new_z2 = Continued . Although the previous approach works, performing the calculations in two steps is awkward MATLAB includes a two-dimensional linear interpolation function, interp2 , that can solve the problem in a single step: interp2(x,y,z,) ans = The first field in the interp2 function .
đang nạp các trang xem trước