How to find the point that resides on a contour that is closest to a known point?
I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0?I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0? I got this from another post of mine.
Z = peaks(50)/10;
level = 0.04;
surf(Z)
hold on
% extract all isocline for a given level
[C,h] = contour(Z,level*[1 1]);
[m,n] = size(C);
ind = find(C(1,:)==level); % index of beginning of each isocline data in C
ind = [ind n+1]; % add end (+1)
for k = 1:numel(ind)-1
xc = C(1,ind(k)+1:ind(k+1)-1);
yc = C(2,ind(k)+1:ind(k+1)-1);
zc = level*ones(size(xc));
plot3(xc,yc,zc,’linewidth’,5);
end
hold off
Now, suppose I know a point (16,35,0.05). I want to find the closest point on a contour whose height is zc = 0.056.
How do I do that? What sort of minimization problem needes to be solved? And how do I replicate the usual minimization that we use in differential calculus like dy/dx =0? matlab MATLAB Answers — New Questions