- #1
physicsCU
- 202
- 1
Hey all:
I am trying to plot the streamlines of a source flow in MATLAB. I just have a couple issues. First, when I change the strength, it doesn't appear that the streamlines change at all. Second, the three lines commented out below, I used them from an example, but now they don't work.
If someone could give me a hand checking this code, that would be great.
Code:
clear all
close all
clc
nx = 100; xmin = -2; xmax = 2;
ny = 100; ymin = -2; ymax = 2;
[x y] = meshgrid(linspace(xmin,xmax,nx),linspace(ymin,ymax,ny));
M = 8; xM = 0; yM = 0;
PsiM = (M/(2*pi))*atan2(y - yM,x - xM);
% levmin = PsiM(1,nx);
% levmax = PsiM(ny,nx/2);
% levels = linspace(levmin,levmax,50);
contour(x,y,PsiM,100)
axis([xmin xmax ymin ymax])
xlabel('x'), ylabel('y')
title('Source of Strength M = 4')
I am trying to plot the streamlines of a source flow in MATLAB. I just have a couple issues. First, when I change the strength, it doesn't appear that the streamlines change at all. Second, the three lines commented out below, I used them from an example, but now they don't work.
If someone could give me a hand checking this code, that would be great.
Code:
clear all
close all
clc
nx = 100; xmin = -2; xmax = 2;
ny = 100; ymin = -2; ymax = 2;
[x y] = meshgrid(linspace(xmin,xmax,nx),linspace(ymin,ymax,ny));
M = 8; xM = 0; yM = 0;
PsiM = (M/(2*pi))*atan2(y - yM,x - xM);
% levmin = PsiM(1,nx);
% levmax = PsiM(ny,nx/2);
% levels = linspace(levmin,levmax,50);
contour(x,y,PsiM,100)
axis([xmin xmax ymin ymax])
xlabel('x'), ylabel('y')
title('Source of Strength M = 4')