Basics
Completion requirements
5. Script M file
A script file is an external file that contains a sequence of MATLAB statements. By typing the filename, subsequent MATLAB input is obtained from the file.
% frictionfactor.m
% Done on 16-Dec-2001
% Re-Done on 28-Jan-2011
D = input('Dia in meter = ');
v = input('Velocity in m/s = ');
rho = 1000; % Density of water in kg/m3
mu = 0.001; % Viscosity of water in kg/m.s
Re = D*v*rho/mu
f = 0.079*Re^(-0.25);
disp(f);
>> frictionfactor Dia in meter = .1 Velocity in m/s = 2 Re = 200000 0.0037