matlab code

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

matlab code

Post by answerhappygod »

matlab code
Matlab Code 1
Matlab Code 1 (11.2 KiB) Viewed 37 times
2D Interpolation Create x and y vectors to represent the following data: yT>xS X = 15 X = 30 = y = 10 z = 23 33 20 45 55 30 60 70 40 82 92 50 111 121 60 140 150 70 167 177 80 198 208 90 200 210 100 220 230

1. Plot both sets of y-z data on the same plot. Add a legend identifying which value of x applies to each data set. 2. Use two-dimensional linear interpolation to approximate the value of z when x= 15 and y = 20. 3. Use two-dimensional cubic spline interpolation to approximate the value of z when x = 15 and y = 20. 4. Use linear interpolation to create a new subtable for x = 20 and x = 25 for all the y-values.

1 ys = ]; 2 3 X = [ 4 5 Z= [ 6 7 8 ]; 9 10 % Plot both sets of y-z data on the same plot. Add a legend identifying which value of x applies to each data set. 11 plot ) 12 title('Problem 1') 13 xlabel('y-data') 14 ylabel('z-data') 15 legend('x=15','x=30', 'Location', 'Northwest) 16 = 20. 17 % Use two-dimensional linear interpolation to approximate the value of z when x = 15 and y 18 new_z_linear = interp2( ) 19 20 21 % Use two-dimensional cubic spline interpolation to approximate the value of z when x = 15 and y = 20. 22 new_z_spline interp2 ) 92

20 21 % Use two-dimensional cubic spline interpolation to approximate the value of z when x = 15 and y = 20. 22 new_z_spline = interp2 23 24 % Use linear interpolation to create a new subtable for x = 20 and x = 25 for all the y-values. 25 new_z_subtable = interp2 ) 26

Unit 6 Test 6 Due Apr 10 by 11:59pm Points 10 Submitting an external tool My Solutions Compute a best fit Wate R in a Culvert Determining how much water will flow through a culvert is not as easy as it might first seem. The channel could have a nonuniform shape, obstructions might influence the flow, friction is important, and so on. A numerical approach allows us to fold all those concerns into a model of how the water actually behaves. ices Consider the following Data Collected From an Actual Culvert height, ft Flow, ft3/s 0 1.7 2.6 1.95 3.6 2.60 4.03 2.92 6.45 4.04 11.22 5.24 30.61 Compute a best-fit linear, quadratic, and cubic equation for the data, and plot them on the same graph. Which model best represents the data? (Linear is first order, quadratic is second order, and cubic is third order.) NOTE: Create a new height: new_h = 0:0.5:6 and use it in the three plots.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply