Develop a program in MatLab using inputdlg and fsolve to solve the non-linear equation above in which the program will solve each of the following situations: -Given d, L, and V or Q, ρ, μ, and 𝜀, compute the head loss hf (head loss problem). -Given d, L, hf, ρ, μ, and 𝜀, compute the velocity V and flow rate Q (flow rate problem). -Given Q, L, hf, ρ, μ, and 𝜀, compute the diameter d of the pipe (sizing problem). -Given Q, d, hf, ρ, μ, and 𝜀, compute the pipe length L. So far, this is what I have if you could please help me with the rest. clear clc % Computer Program that solves the Colebrook Equation when given the following % situations %1.) Head loss Problem % Given D,L, and V, or Q,rho,nu,or epsilon, compute the head loss(Hf) %2.) Flow Rate Problem % Given D,L,Hf,rho, nu, and epsilon, compute the velocity(V) and flow % rate(Q). %3.)Sizing Problem % Given Q,L,Hf,rho,nu, and epsilon, compute the diameter(D) of the pipe. %4.) Length Problem % Given Q,D,Hf, rho, nu, and epsilon, compute the length(L) % Colebrook Equation: % 1/sqrt(f) = -2log10(epsilon/D/3.7 + 2.51/Re/sqrt(fguess)) questions = {‘What is the pipe diameter(D), in (m)?’,… ‘What is the pipe length(L), in (m)?’,… ‘what is the fluid velocity(V) in (m/s)?’,… ‘What is the volumetric Flow Rate(Q), in (m^2/s)?’,… ‘What is the denisty(rho), in (kg/m^3)?’,… ‘What is the kinematic viscosity(nu), in (Ns/m^2)?’,… ‘What is the surface roughness(epsilon), in (m)?’,… ‘What is your headloss(fguess), in (m)?’,… ‘What is the area(A), in (m^2)?’}; colebrook_eq_values = inputdlg(questions) D = str2num(user_vals{1}) L = str2num(user_vals{2}) V = str2num(user_vals{3}) Q = str2num(user_vals{4}) rho = str2num(user_vals{5}) nu = str2num(user_vals{6}) epsilon = str2num(user_vals{7}) fguess = str2num(user_vals{8}) A = str2num(user_vals{9}) %Computing the Friction Factor g = 9.81; %gravity(g) in units of (m/s^2) A = pi(D/2)^2; V = Q/A; Re = (VD/nu); fnew = (-2log10(epsilon/D/3.7+2.51/Re/sqrt(f)))^-2; |
Colebrook Equation:

0 comments