フィルターのクリア

I will find an xy dataset satisfying an implicit equation.

2 ビュー (過去 30 日間)
kadir can erbas
kadir can erbas 2023 年 9 月 25 日
編集済み: Bruno Luong 2023 年 9 月 26 日
(x^2 + y^2)^3 + (15*x + 3.3*y)*(x^2 + y^2)^2 + (62.5*x^2 + 20*x*y - 8.37*y^2)*(x^2 + y^2) - 17*x^3 + 11*x^2*y + 17*x*y^2 - 11*y^3 + 432*x^2 - 24*x*y + 67*y^2 - 82*x + 400*y - 1037=0
I have the above equation and I want to obtain 200 xy points satisfying the equation. How can I find?

採用された回答

Bruno Luong
Bruno Luong 2023 年 9 月 25 日
編集済み: Bruno Luong 2023 年 9 月 26 日
f = @(x,y)(x.^2 + y.^2).^3 + (15.*x + 3.3.*y).*(x.^2 + y.^2).^2 + (62.5.*x.^2 + 20.*x.*y - 8.37.*y.^2).*(x.^2 + y.^2) - 17.*x.^3 + 11.*x.^2.*y + 17.*x.*y.^2 - 11.*y.^3 + 432.*x.^2 - 24.*x.*y + 67.*y.^2 - 82.*x + 400.*y - 1037;
n = 8;
while true
xg = linspace(-8,8,n+1);
yg = linspace(-8,8,n+1);
[Xg,Yg] = meshgrid(xg,yg);
z=f(Xg,Yg);
close all
a = contour(Xg,Yg,z,[0 0]);
if a(2,1) >= 200
break
end
n = 2*n;
end
xy = a(:,2:end);
x = xy(1,:);
y = xy(2,:);
hold on
axis equal
h1=plot(x, y, '.b');
for k=1:size(xy,2)
if ismember(x(k),xg)
y(k) = fzero(@(y) f(x(k),y), y(k));
else
x(k) = fzero(@(x) f(x,y(k)), x(k));
end
end
xy = [x(:), y(:)]
xy = 253×2
-2.4309 -6.7500 -2.5000 -6.7679 -2.6250 -6.7968 -2.7500 -6.8211 -2.8750 -6.8409 -3.0000 -6.8561 -3.1250 -6.8667 -3.2500 -6.8727 -3.3750 -6.8739 -3.5000 -6.8704
h2=plot(x, y, '.r');
legend([h1 h2],'approximation', 'accurate')
figure
plot(f(x,y)) % should be close to 0
  1 件のコメント
kadir can erbas
kadir can erbas 2023 年 9 月 26 日
This is exactly what I want. Thanks. :)

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

その他の回答 (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