I obtained different figure after using fsurf and surf

3 ビュー (過去 30 日間)
Casey lv
Casey lv 2020 年 4 月 27 日
コメント済み: Toder 2020 年 4 月 29 日
Here is the code, I think these two commands will generate the same figure but it did not.
% syms x t;
k = 0.6;
sigma=-0.5;
r =0.5;
s = 1.2;
x=10;t=0;
lambda=k.*sqrt(2.*r.^2./-sigma);
A=lambda.*((k.*jacobiSN(r.*x-s.*t,k.^2).*jacobiCN(r.*x-s.*t,k.^2))./(jacobiDN(r.*x-s.*t,k.^2)));
AA=lambda.*((k.*jacobiSN(r.*x-s.*t,k.^2).*jacobiCN(r.*x-s.*t,k.^2))./(jacobiDN(r.*x-s.*t,k.^2)));
B=4.*r.*s.*ellipticE(k.^2).*ellipticK(k.^2).^(-1)+(-2).*r.*s.*jacobiDN(s.*t+(-1).*r.*x,k.^2).^(-2).*(1+(-1).*k.^2+jacobiDN(s.*t+(-1).*r.*x,k.^2).^4);
A;
B;
lambda;
[x,t]=meshgrid(-5:0.2:5);
bb=k.*jacobiSN(r.*x-s.*t,k.^2).*jacobiCN(r.*x-s.*t,k.^2)./(jacobiDN(r.*x-s.*t,k.^2));
figure;
mesh(x,t,abs(bb));
syms c d;
bb=k.*jacobiSN(r.*c-s.*d,d.^2).*jacobiCN(r.*c-s.*d,k.^2).*(jacobiDN(r.*c-s.*d,k.^2)).^(-1);
figure;
fsurf(abs(bb),'MeshDensity',10);
g=400-300+500;
g
  1 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 4 月 27 日
In your code, the 2nd equation is reciprocal of the first. Shouldn't that change the output.

サインインしてコメントする。

採用された回答

Toder
Toder 2020 年 4 月 28 日
It appears you may have a typo in your second definition of bb. Your first call to jacobiSN in this line currently reads as
jacobiSN(r.*c-s.*d,d.^2)
Based on your first definition of bb, it looks like it should instead be
jacobiSN(r.*c-s.*d,k.^2)
  2 件のコメント
Casey lv
Casey lv 2020 年 4 月 29 日
Thanks a lot. I have another question, I definitely make sure the function is same in Mathmatica and Matlab. But the figure is different if I plot the abs of the function. The command is Plot3D[Abs[B],...] in Mathmatica. Do you know something about this?
Toder
Toder 2020 年 4 月 29 日
Sorry, I don't know much about Mathematica. My only recommendation is to check that the axes are the same; if they're different than the surf in Matlab the plot could look very different.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by