What is the best and quick way to find the intersections points set of two 3d surfaces?

12 vues (au cours des 30 derniers jours)
Hi,
I am looking for the easiest best and quick way to find the intersections points of two surfaces in which the points for each curve be reported separately. As an example here there are two surfaces defined in specific domains which have two intersections. I am looking for the points on each one of these two intersection curves in seperated groups. e.g.
Curve 1:
[ x0 y0; x1 y1; x2 y2;...; xn yn]
Curve 2:
[ x0 y0; x1 y1; x2 y2;...; xn yn]
syms x y
f = (x-1)*exp(-y^3-x^2);
g = .5-sqrt(x*exp(-x^2-y^2));
ezsurf(f,[0,2],[-2,2]);
hold on
ezsurf(g,[0,2],[-2,2]);
  2 commentaires
Torsten
Torsten le 6 Sep 2022
f = @(x,y)(x-1).*exp(-y.^3-x.^2);
g = @(x,y) 0.5-sqrt(x.*exp(-x.^2-y.^2));
h = @(x,y) f(x,y)-g(x,y);
fimplicit(h)
Mehdi
Mehdi le 7 Sep 2022
Modifié(e) : Mehdi le 7 Sep 2022
As I insisted in my question I am looking for a closed method that only reports the points of each curve separately. Your suggested method just plotted the f-g which is useless for me. In Maple there is a plots:-implicitplot command which groups the data of each curve seperately without plotting something. I am looking for similar command in Matlab, if any.

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 7 Sep 2022
Modifié(e) : Matt J le 8 Sep 2022
You can to download this FEX submission,
f = @(x,y)(x-1).*exp(-y.^3-x.^2);
g = @(x,y) 0.5-sqrt(x.*exp(-x.^2-y.^2));
h = @(x,y) real(f(x,y)-g(x,y));
[X,Y]=deal(linspace(-6,6,1000));
[~,result]=getContourLineCoordinates( contourc(X,Y,h(X,Y'),[0,0]) )
result = 1×2 cell array
{996×2 double} {327×2 double}
  19 commentaires
Mehdi
Mehdi le 17 Sep 2022
Modifié(e) : Mehdi le 17 Sep 2022
"Operator '+' is not supported for operands of type 'function_handle'" error occurs before the calculation of ZZ. How to get rid of this error first?
Torsten
Torsten le 17 Sep 2022
By not using function handles, as I wrote.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by