Q:

) The Mystical River’s water flow rate on a particular day is shown in the table below. The time is measured in hours and the water flow rate is measured in cubic feet per second

0

 The Mystical River’s water flow rate on a particular day is shown in the table below. The time is measured in hours and the water flow rate is measured in cubic feet per second. Write a script that will fit polynomials of degree 3 and 4 to the data and create a subplot for the two polynomials. Plot also the original data as black circles in both plots. The titles for the subplots should include the degree of the fitted polynomial. Also, include appropriate x and y labels for the plots.

Time 0 6 9 12 15 18 21 24
Flow Rate 800 980 1090 1520 1920 1670 1440 1380 1300

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ch14Ex20.m

% Plot the water flow rate for the Mystical River one day

% Fit polynomials of order 3 and 4 through the points and plot

time = 0:3:24;

flows = [800 980 1090 1520 1920 1670 1440 1380 1300];

subplot(1,2,1)

curve = polyfit(time,flows,3);

y3 = polyval(curve,time);

plot(time,flows,'ko',time,y3)

xlabel('Time')

ylabel('Flow rate')

title('Order 3 polynomial')

subplot(1,2,2)

curve = polyfit(time,flows,4);

y4 = polyval(curve,time);

plot(time,flows,'ko',time,y4)

xlabel('Time')

ylabel('Flow rate')

title('Order 4 polynomial')

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now