簡體   English   中英

我想在matlab中繪制一個流函數

[英]I am trying to draw a stream function in matlab

我正在使用此代碼捕捉來繪制流函數

[X,Y]= meshgrid(linspace(0,80),linspace(-8,8));
[t]=meshgrid(linspace(0,100));
B=1+0.3*cos(0.9*t);
k=2*phi/10;
low=.1+k.^2.*B.^2.*sin(k.*(X-0.9.*t)).^2;
PSI=-tanh((Y-B.*cos(k.*(X-0.9.*t)))./sqrt(low));
contour(X,Y,PSI,3);
colormap cool

我想要像圖片那樣的東西。 我只得到當前的(罪形狀線)而不是渦旋(矩形)。 在此輸入圖像描述在此輸入圖像描述

我嘗試使用顯示的參數生成繪圖, 但我沒有設法在等高線圖中獲得“渦旋”形狀 這是我的實現:

len = 200;
[X,Y] = meshgrid(linspace(0,80,len), linspace(-8,8,len));
t = meshgrid(linspace(0,1,len));

a = 1.2;
c = 0.12;
k = 2*pi/7.5;
w = 0.4;
e = 0.3;

B = a + e * cos(w*t);
D = k * (X - c*t);
PSI = - tanh((Y - B.*sin(D)) ./ sqrt(1 + (k * B.*cos(D)).^2)) + c*Y;

figure('Position',[100 100 650 300])
movegui('center')

subplot(211)
contour(X, Y, PSI, 10), ylim([-4.5 4.5])
%colormap cool
xlabel('kilometers'), ylabel('km'), title('Mobility Model')

subplot(212), axis off
text(0.5, 0.5, ...
    {['$\psi(x,y,t) = -\tanh{[ \frac{y - B(t) \sin(k(x-ct))}' ...
    '{\sqrt{1 + k^2 B^2(t) \cos^2(k(x-ct))}} ]} + cy$'];
    '$where\, B(t) = A + \epsilon cos(\omega t)$'}, 'Interpreter','latex', ...
    'FontSize',20, 'Horizontal','center', 'Vertical','middle')

matlab_contour_plot


這導致我相信您顯示的屏幕截圖與下面的等式/參數不完全匹配...

\n

事實上,如果我們在3D中查看曲面圖,您會發現曲線中沒有形狀看起來像正弦曲線之間的那些三角形。 它只是兩個幾乎平坦的飛機,兩者之間有凹陷的下降。

這是二維函數,顯示為曲面圖:

surf(X, Y, PSI, 'FaceColor','interp', 'EdgeColor','none')
daspect([20 6 1])
axis vis3d, axis tight
box on, grid on, view(140,30)
xlabel X, ylabel Y, zlabel PSI
lighting phong
camlight left

surface_3d

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM