MATLAB: How to make a curve line through data points on surface 3D (curve line fitting in 3D)

curve line fitting in 3d

Dear everyone,
I have a suface 3D in matlab. I want to build a curve line through data points (A, B, C, D) in this surface. I think this is the curve line fitting of surface. I try to do that but I couldn't obtain result. Please Help me for this.
The code is showed below.
Many thanks,
Best regard.
clear all;
clc;
x1 = [10,11,12,10,11,12,10,11,12,10,11,12];
x2 = [60,60,60,70,70,70,80,80,80,90,90,90];
Profit = [133.355, 151.273, 143.703, 201.625, 218.227, 209.948, 219.271, 246.907, 233.791, 215.890, 246.132, 228.042];
xv = 10:0.1:12;
yv =60:1:90;
[X,Y] = ndgrid(xv, yv);
Z = griddata(x1, x2, Profit, X, Y, 'cubic');
figure
surf(X,Y,Z)
grid on
hold on
A=scatter3(x1(8),x2(8),Profit(8),'filled','MarkerFaceColor', 'y')
B=scatter3(x1(2),x2(2),Profit(2),'filled','MarkerFaceColor', 'y')
C=scatter3(x1(5),x2(5),Profit(5),'filled','MarkerFaceColor', 'y')
D=scatter3(x1(11),x2(11),Profit(11),'filled','MarkerFaceColor', 'y')
xlabel('Скорость, м/с'), ylabel('Грузоподъемность, т'), zlabel('Profit, 10^4*$')
view(-120,47)

Best Answer

Try this solution
x0 = x1([8 2 5 11]);
y0 = x2([8 2 5 11]);
yy = linspace(min(y0),max(y0),20);
xx = interp1(y0,x0,yy);
zz = interp2(X',Y',Z',xx,yy);
line(xx,yy,zz,'linew',2)
result