Plotting implicit equation with fimplicit

2 ビュー (過去 30 日間)
Jay
Jay 2019 年 2 月 11 日
コメント済み: Torsten 2019 年 2 月 11 日
Hello
I have tried to plot this implicit equation. But when I tried it, the plot is showing empty.
Here is the code I used to plot. Could anyone help me with this.
Thanks in advance
clc
syms f(x,y)
n = 8;
a1 = 1.0086*y - 0.9216*(x - y);
b1 = 1.0107*(-x) - 1.0086*(y);
c1 = 0.9216*(x - y) - 1.0107*(-x);
h1 = 0.5877*(161.65);
I3 = ((a1.* b1.*c1)/(54))-((b1.*(h1.^2))/(6));
I2 = ((h1.^2)/(3))+((a1.^2 + b1.^2 + c1.^2)/(54));
th = acos(I3/(I2.^(3/2)));
v1 = ((2*th)+pi)/6;
an1 = (abs(2*cos(v1)))^n;
an2 = (abs(2*cos((2*th+3*pi)/6)))^n;
an3 = (abs(2*cos((2*th+5*pi)/6)))^n;
f(x,y) = ((3*I2).^(n/2)) * (an1 + an2 + an3) - (2*(189.32)^8);
fimplicit(f)

採用された回答

Torsten
Torsten 2019 年 2 月 11 日
function main
fimplicit (@(x,y)f(x,y))
end
function fun = f(x,y)
n = 8;
a1 = 1.0086*y - 0.9216*(x - y);
b1 = 1.0107*(-x) - 1.0086*(y);
c1 = 0.9216*(x - y) - 1.0107*(-x);
h1 = 0.5877*(161.65);
I3 = ((a1.* b1.*c1)/(54))-((b1.*(h1.^2))/(6));
I2 = ((h1.^2)/(3))+((a1.^2 + b1.^2 + c1.^2)/(54));
th = acos(I3./(I2.^(3/2)));
v1 = ((2*th)+pi)/6;
an1 = (abs(2*cos(v1))).^n;
an2 = (abs(2*cos((2*th+3*pi)/6))).^n;
an3 = (abs(2*cos((2*th+5*pi)/6))).^n;
fun = ((3*I2).^(n/2)).* (an1 + an2 + an3) - (2*(189.32)^8);
end
Resonable limits for plotting are required - no zeros are found in the default range [-5:5] for x and y.
  6 件のコメント
Jay
Jay 2019 年 2 月 11 日
編集済み: Jay 2019 年 2 月 11 日
Hello Torsten
It works. But it is not working with other limits. Can you explain why so?
Thank you.
Torsten
Torsten 2019 年 2 月 11 日
It "works" as long as the object is contained in the box defined by the specified limits for x and y.

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

その他の回答 (1 件)

John D'Errico
John D'Errico 2019 年 2 月 11 日
編集済み: John D'Errico 2019 年 2 月 11 日
Easy enough. Try this, for example.
vpasolve(f(1,y))
ans =
-80.224189505722446658042301607259
vpasolve(f(-20,y))
ans =
63.634253282860063957543062643774
Hmm. So [1,-80] is roughly a solution. That should be a good hint as to where to have fimplicit look.
fimplicit(f,[-150,150,-150,150])
axis equal
grid on
The problem was fimplicit looks by default in a rather narrow set of limits on x and y. It cannot know where it SHOULD be looking, and computer programs can sometimes be so clueless. Since fimplicit just found no solutions at all in the domain it was looking by default, you saw an empty figure. Sometimes you need to give even a computer a nudge in the right direction.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by