How to 2D plot using the equation of fi and zi?
1 次查看(过去 30 天)
显示 更早的评论
![fig1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237022/fig1.jpeg)
![fig.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237023/fig.jpeg)
采纳的回答
Bruno Luong
2019-9-5
编辑:Bruno Luong
2019-9-5
The wikipedia page plots only the polar sector 2*pi/(2*n) of the stream lines / potential
The second plot is the full picture.
n = 3/2;
A = 1;
x=linspace(-1,1,21);
y=linspace(-1,1,21);
[X,Y]=ndgrid(x,y);
Z=X+1i*Y;
W = A*Z.^n;
phi = real(W);
psi = imag(W);
close all
subplot(2,1,1);
hold on
plot(phi,psi,'b');
plot(phi.',psi.','g');
axis equal
subplot(2,1,2);
hold on
contour(x,y,phi.',20,'b');
contour(x,y,psi.',20,'g');
axis equal
![toto.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237036/toto.png)
2 个评论
darova
2019-9-5
Use polar system of coordinates then:
n = -1.5;
A = 1;
r = linspace(0,2,30);
th = linspace(0,2*pi,100);
[R, TH] = meshgrid(r,th);
fi = A*R.^n.*cos(n*TH);
zi = A*R.^n.*sin(n*TH);
[X,Y] = pol2cart(TH,R);
contour(X,Y,fi,'g')
hold on
contour(X,Y,zi,'b')
hold off
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!