Plotting implicit equation with fimplicit
7 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
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 个评论
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
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!