Professional Documents
Culture Documents
(ii)
% Part (b) (ii) of Question 3
for n = 1 : N
k1 (1) = h*y(2,n);
k1 (2) = h*y(3,n);
k1 (3) = h * -0.5*y(1,n)*y(3,n);
k2 (1) = h*(y(2,n) + k1 (2));
k2 (2) = h*(y(3,n) + k1 (3));
k2 (3) = h * -0.5*( y(1,n) + k1 (1))*(y(3,n) + k1 (3));
y(:,n+1) = y(:,n) + 0.5*( k1' + k2');
z(n+1) = z(n) + h;
end
(iii)
% Part (b) (iii) of Question 3
% Output of the IVP solution
for n = 1 : N + 1
f(n) = y(1,n); % values of y for every z-instance
U_p(n) = y(2,n); % values of velocity profile, U for every z-
instance
U_g(n) = y(3,n); % values of velocity gradient, U' for every z-
instance
fprintf('%10.4 f | %10.4 f | %10.4 f | %10.4 f\n',z(n),y(1,n),y(2,n),y(3,n))
end
(iv)
The velocity profile U(z) semi-linearly increases with z till a maximum unity velocity achieved.
Thereafter, the velocity remains constant despite the increasing values of z and so the graph flattens
off.
The velocity gradient profile depicts a decreasing behaviour with the increasing values of z. For the
regions in which the velocity profile is constant, the velocity gradient is zero.
(v)
As seen in the graphical profile of velocity U(z) against z, as z approaches 10 i.e. beyond z = 6, U(z)
flattens off to unity. Similary, for the velocity gradient profile, U’(z) approaches zero as z tend
towards 10. This conforms to the mathematical behaviour of derivatives of constants (which is always
a zero) i.e.
dU
U' (z )=
dz
d
If U ( z ) → 1, then (1 )=0
dz
So ,U ' ( z ) → 0 for z →1 0
Thus the velocity gradient profile tends to zero as mathematically expected.