Skip to content

Instantly share code, notes, and snippets.

@mick001
Created August 28, 2015 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mick001/6ef0da8d76b66ccfee58 to your computer and use it in GitHub Desktop.
Save mick001/6ef0da8d76b66ccfee58 to your computer and use it in GitHub Desktop.
Complex functions and flow around a cylinder part 2 (matlab). Full article available at: http://www.firsttimeprogrammer.blogspot.com/2015/07/complex-functions-and-flow-around.html
%%Gradient and flow
figure
subplot(1,2,1);
[Dx, Dy] = gradient(real(z));
Dx(isinf(Dx)) = 0;
Dy(isinf(Dy)) = 0;
hQuiver = quiver(x,y1,Dx,Dy,'LineWidth',1); hold on;
viscircles([0 0],1,'LineWidth',1); hold off;
title('u(x,y) gradient, vector field');
%%Imaginary part
subplot(1,2,2)
contour(x,y1,imag(z),linspace(-10,10,100)); title('Contour of Im(f)');
hold on;
viscircles([0 0],1,'LineWidth',1); hold off;
xlabel('x'); ylabel('y'); %clabel(C3);
title('Imaginary part');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment