Write a matlab code for a Uniform flow flowing in X direction.
Write a matlab code for a uniform flow flowing in X – direction having a constant velocity depicting equipotential lines and streamlines .
Matlab code for a uniform flow flowing in X-direction having equipotential lines and streamlines is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | U = 1; % Uniform stream % GRID: x = -4:.04:4; y = -4:.04:4; for m = 1:length(x) for n = 1:length(y) xx(m,n) = x(m); yy(m,n) = y(n); % Velocity potential function : phi_UniFlow(m,n) = U * x(m); % Stream function : psi_UniFlow(m,n) = U * y(n); end end % Plots % Uniform stream in x direction: contour(xx,yy,psi_UniFlow,[-3:0.5:3], 'k' ),hold on contour(xx,yy,phi_UniFlow,[-3:1:3], 'r' ) axis image,hold off title( 'Uniform stream flow in x direction' ) xlabel( 'x' ),ylabel( 'y' ) |
Equipotential lines and streamlines