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
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