我正在尝试使用流函数绘制流线:
psi = Y.*(F.*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (1 + F.*M.^2*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))-(F + (1 + phi.*cos(2.*pi.*X))).*sinh(M.*Y)/(1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M )+ (alpha.*((F + (1 + phi.*cos(2.*pi.*X))).*Y.*cosh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + Y.*(-1 + 2.*(1 + phi.*cos(2.*pi.*X)).^2.*M.^2- 2.*M.*Y.*cosh(M.*Y).*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))- 2.*(1 + phi.*cos(2.*pi.*X)).*M.*sinh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + 2.*((1 + phi.*cos(2.*pi.*X)).*M.*(Y + (1 + phi.*cos(2.*pi.*X)).^2.*M.^2.*beta).*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-Y + (1 + phi.*cos(2.*pi.*X)).*M.*2.*((1 + phi.*cos(2.*pi.*X)).^2 - (1 + phi.*cos(2.*pi.*X)).*beta + Y.*beta)).*sinh((1 + phi.*cos(2.*pi.*X).*M)).*sinh(M.*Y)))./8.*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.* beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M)).^2));
我写了一段代码:
M = 0;
phi = 0.4;
beta = 0.0;
theta = 0.65;
F = theta - 1;
alpha = 0.0;
[X,Y]= meshgrid(linspace(-0.5,0.5),linspace(0,1.5));
Z = Y.*(F.*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (1 + F.*M.^2*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))-(F + (1 + phi.*cos(2.*pi.*X))).*sinh(M.*Y)/(1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M )+ (alpha.*((F + (1 + phi.*cos(2.*pi.*X))).*Y.*cosh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + Y.*(-1 + 2.*(1 + phi.*cos(2.*pi.*X)).^2.*M.^2- 2.*M.*Y.*cosh(M.*Y).*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))- 2.*(1 + phi.*cos(2.*pi.*X)).*M.*sinh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + 2.*((1 + phi.*cos(2.*pi.*X)).*M.*(Y + (1 + phi.*cos(2.*pi.*X)).^2.*M.^2.*beta).*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-Y + (1 + phi.*cos(2.*pi.*X)).*M.*2.*((1 + phi.*cos(2.*pi.*X)).^2 - (1 + phi.*cos(2.*pi.*X)).*beta + Y.*beta)).*sinh((1 + phi.*cos(2.*pi.*X).*M)).*sinh(M.*Y)))./8.*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.* beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M)).^2));
contour(X,Y,Z,100)
[C,h] = contour(X,Y,Z);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
colormap cool
我正在
Warning: Matrix is singular to working precision.
Warning: Contour not rendered for non-finite ZData
> In contour>parseargs at 192
In contour at 69
Warning: Contour not rendered for non-finite ZData
> In contour>parseargs at 192
In contour at 69
有什么问题?感谢。
答案 0 :(得分:1)
你正在划分单个矩阵:
(F +(1 + phi。* cos(2. * pi。* X)))。* sinh(M. * Y)/ (1 + phi。* cos(2. * pi。 * X))强>
我认为你在斜线前错过了一个点:
M = 1;
phi = 0.4;
beta = 0.0;
theta = 0.65;
F = theta - 1;
alpha = 0.0;
[X,Y]= meshgrid(linspace(-0.5,0.5),linspace(0,1.5));
Z = Y.*(F.*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (1 + F.*M.^2*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))-(F + (1 + phi.*cos(2.*pi.*X))).*sinh(M.*Y)./(1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M )+ (alpha.*((F + (1 + phi.*cos(2.*pi.*X))).*Y.*cosh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + Y.*(-1 + 2.*(1 + phi.*cos(2.*pi.*X)).^2.*M.^2- 2.*M.*Y.*cosh(M.*Y).*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M)+ (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.*beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M))- 2.*(1 + phi.*cos(2.*pi.*X)).*M.*sinh(2.*(1 + phi.*cos(2.*pi.*X)).*M) + 2.*((1 + phi.*cos(2.*pi.*X)).*M.*(Y + (1 + phi.*cos(2.*pi.*X)).^2.*M.^2.*beta).*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-Y + (1 + phi.*cos(2.*pi.*X)).*M.*2.*((1 + phi.*cos(2.*pi.*X)).^2 - (1 + phi.*cos(2.*pi.*X)).*beta + Y.*beta)).*sinh((1 + phi.*cos(2.*pi.*X).*M)).*sinh(M.*Y)))./8.*((1 + phi.*cos(2.*pi.*X)).*M.*cosh((1 + phi.*cos(2.*pi.*X)).*M) + (-1 + (1 + phi.*cos(2.*pi.*X)).*M.^2.* beta).*sinh((1 + phi.*cos(2.*pi.*X)).*M)).^2));
contour(X,Y,Z,100)
[C,h] = contour(X,Y,Z);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
colormap cool
另外,请务必将M更改为与0
不同的值