Skip to content

Instantly share code, notes, and snippets.

@kcajf
kcajf / keybase.md
Created February 18, 2019 02:39
keybase.md

Keybase proof

I hereby claim:

  • I am kcajf on github.
  • I am jackf (https://keybase.io/jackf) on keybase.
  • I have a public key ASBKNOsqkHKxQPwXs9kzhzc8-Qab0hcAJQx2ovdNMNntTgo

To claim this, I am signing this object:

@kcajf
kcajf / q_from_f.m
Created February 21, 2014 21:10
MATLAB Q from f function
function [ q ] = q_from_f( f, R )
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
q = sqrt( 6 / (391.7 + (800*f)/(pi^2 * R^5 * 9.81)));
end
@kcajf
kcajf / moody.m
Created February 21, 2014 21:09
MATLAB Moody diagram function
function [ f ] = Moody( Re, r )
% Returns friction factor for Reynold's number Re, relative roughness r
% Uses Haaland equation
f = (1./(-1.8 *log10( (r/3.7)^(1.11) + 6.9./Re)).^2)./4;
end
@kcajf
kcajf / iterator.m
Created February 21, 2014 21:08
MATLAB friction factor iterator
Re_guess = 2e4;
r = 0.002; % roughness
R = 0.075; % pipe radius
D = 2*R;
p = 1000; % density
visc = 1.141e-3; % viscosity
latest_q = q_from_f(f_guess, R)
penultimate_q = 1;