The following data was collected for the steady flow of water in a concrete circ
ID: 3758572 • Letter: T
Question
The following data was collected for the steady flow of water in a concrete circular pipe:
Diameter, m: 0.3, 0.6, 0.9, 0.3, 0.6, 0.9, 0.3, 0.6, 0.9
Slope, m/m: 0.001, 0.001, 0.001, 0.01, 0.01, 0.01, 0.05, 0.05, 0.05
Flow, m3 /s: 0.04, 0.24, 0.69, 0.13, 0.82, 2.38, 0.31, 1.95, 5.66
Use Matlab code for multiple linear regression to fit the following model to this data: Q0 = a0*Da1*Sa2 , where Q = flow, D = diameter, and S = slope. Submit program or print out of command window with final expression.
Explanation / Answer
load carsmall
%Here the data declaring arrays
D = [0.3 0.6 0.9 0.3 0.6 0.9 0.3 0.6 0.9 ];
S = [0.001 0.001 0.001 0.01 0.01 0.01 0.05 0.05 0.05]
F = [0.04 0.24 0.69 0.13 0.82 2.38 0.31 1.95 5.66]
a = [1 1 1 1 1 1 1 1 1] % Removes NaN data
scatter3(D,S,F,a,'filled')
hold on
Dfit = min(D):100:max(D);
Sfit = min(S):10:max(S);
Qfit = min(F):10:max(F);
[DFIT,SFIT,QFIT] = meshgrid(Dfit,Sfit,Qfit); %creating mesh grid
QFIT = a(0)*DFIT*a(1)*SFIT*a(2); %here model calculation
mesh(DFIT,SFIT,QFIT)
xlabel('Diameter') %labels declared
ylabel('Slope')
zlabel('Flow')
view(50,10)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.