MATLAB Answers

How do I get the intersection function of 2 surfaces?

5 views (last 30 days)
Carolin Bock
Carolin Bock on 4 Aug 2020
Commented: Carolin Bock on 4 Aug 2020
I'm having a surface and need to finde the interseciton function of this surface with a surface at 0.9. Is this possible? Actually, I only need to set the suface function equal to 0.9. But I don't know how to get the final intersection function.
That's what I have so far:
[X1,Y1] = meshgrid(1:0.025:1.7,0.05:0.05:0.25);
a1 = 15.32;
b1 = 1.945;
c1 = 1.033;
d1 = -0.01932 ;
e1 = 3.591;
f1 = 0.1616;
Z1 = (0.5 .*(a1.*exp(-b1.*X1)+ e1.*exp(-f1.*X1))-c1.*exp(-d1.*X1)).*Y1.^2 +0.5.*(a1.*exp(-b1.*X1)-e1.*exp(-f1.*X1)).*Y1+c1.*exp(-d1.*X1)
s = surf(X1,Y1,Z1,'FaceColor',[0.1 0.0 1.0],'FaceAlpha',0.8,'EdgeColor', 'black','LineStyle','none', 'EdgeAlpha',0.2,'FaceLighting','flat')
hold on;
v = [0.9 0.9]
M1 = contour(X1,Y1,Z1,v)
Thank you:)


Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 4 Aug 2020
The intersection function will rarely exist as a "function". At best, it is an implicit function, thus a problem with solution locus defined only as the set of solutions to an equation. Your implicit function is nonlinear, and sufficiently so that no simple algebraic form will exist to extract the solution locus for your problem.
To plot that implicit function, you use a contour plot. In fact, it appears you already know that fact, so there is little I need to do here.
You can extract the points along that contour using contourc, without creating the contour plot itself. However, contour also returns that same information as it does the contour plot.
M1 = contour(X1,Y1,Z1,v)
M1 =
Columns 1 through 9
0.9 1.7 1.675 1.65 1.625 1.6 1.575 1.55 1.525
17 0.17037 0.17213 0.17411 0.17635 0.17889 0.18175 0.18499 0.18867
Columns 10 through 18
1.5 1.475 1.4641 1.45 1.425 1.4 1.375 1.35 1.3381
0.19286 0.19765 0.2 0.20358 0.2109 0.2196 0.23005 0.24279 0.25
Here, M1(1,1) is the value of the level curve, thus 0.9.
M1(2,1) is the number of points it found along that curve. Note that sometimes a contour may be represented as disjoint, non-intersecting sets. so you may have multiple curves that represent a single contour. So these first two numbers are necessary to describe the contour.

  1 Comment

Carolin Bock
Carolin Bock on 4 Aug 2020
Thanks for your answer!:) I thought it might be possible to actually get the function in form of f(x) = y of the intersection because I have a function f(X,Y) = 0.9.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!