Created
August 28, 2015 19:31
-
-
Save mick001/23dc5a2dc01131df5cfe to your computer and use it in GitHub Desktop.
Complex functions and flow around a cylinder part 1 (matlab). Full article available at: http://www.firsttimeprogrammer.blogspot.com/2015/07/complex-functions-and-flow-around.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Set up | |
x = -4:0.2:4; | |
y1 = -4:0.2:4; | |
y = (-4:0.2:4)*1i; | |
[X, Y]= meshgrid(x,y); | |
% Complex variable s | |
s = X + Y; | |
% Complex function f(z) | |
z = s + 1./s; | |
%-------------------------------------------------------------------------- | |
% Plot the surfaces (abs(), real() and imag()) | |
%Absolute value | |
figure | |
subplot(1,3,1); | |
surfc(x,y1,abs(z)); | |
xlabel('x');ylabel('y');zlabel('z'); | |
title('Absolute value'); | |
%Real part | |
subplot(1,3,2) | |
surfc(x,y1,real(z)); | |
xlabel('x');ylabel('y');zlabel('z'); | |
title('Real part'); | |
%Imaginary part | |
subplot(1,3,3) | |
surfc(x,y1,imag(z)); | |
xlabel('x');ylabel('y');zlabel('z'); | |
title('Imaginary part'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment