how i can add point to mesh plot and connect it with mesh surface??

Dear All,
I have a 3-D mesh plot, i added data point to same plot using plot3 command i want to connect this point to mesh surface with stems
any body help me?

1 Comment

You should not be opening second copies of questions on existing open topics, like you did in http://www.mathworks.com/matlabcentral/answers/58041#comment_120908. You waited 7 hours to reply to me, and then just one hour later you were frustrated enough with my not having replied that you opened a new question. If you need fast replies but only when you get around to bothering yourself with the matter, then you should be paying a consultant and have response time clauses in the contract. When I am volunteering and you leave me hanging for 7 hours then I am likely to go to sleep.

Sign in to comment.

Answers (3)

line() or plot3() in place the stems, or possibly annotate() them.
stem3 displays 3-D stem plots extending from the xy-plane.
but you would need them extending from arbitrary (X,Y,Z) coordinates.
stem3() produces a stemseries object, which is a coordinating object with a number of line (not lineseries) objects. So you could create the line objects yourself.
i used plot3 command it just put points on the plot, i need to connect this point with mesh surface as stems extended from mesh surface

7 Comments

Well, you can't do that. The best you can do is to use line() or plot3() to draw lines that look exactly like stems, but in fact are not handle graphics objects of type series.stemseries. They won't be real stems, but they will look like stems.
i.e i want to show error between the data that i entered and data on mesh surface
line() or plot3() the stems into existence. You know the X and Y coordinates for each location, right? And the mark you want to draw will go vertically into Z, right? And you know the Z at those X and Y coordinates, right? And you know or can trivially calculate the new Z, right? So
plot3([X, X], [Y, Y], [Z, NewZ])
plot3([X, X], [Y, Y], [NewZ, NewZ], 'o') %put marker on top
a=[8.5319;
5.8468;
1.9691;
1.3863;
-2.5172;
2.7046]
F=a(1)+a(2)*X+a(3)*Y+a(4)*X.^2+a(5)*X.*Y+a(6)*Y.^2;
x1=-1:.01:1;
y1=-2:.01:2;
[X,Y]=meshgrid(x1,y1);
%data points
z=[7.87 18.36 2.94 12.43 14.30 9.76... 20.26 13.83 14.81 22.76 5.82 6.41... 18.63 15.10 14.30]';
%x vector
x=[.39 .28 -.37 -.55 .12 .77... .99 .13 -.93 -.27 -.96 -.35... .50 .37 .66]';
%y-vector
y=[-.48 -1.91 -.2 .18 -1.25 -.17... .83 -1.82 1.54 1.87 .19 -1.61... -1.23 -1.33 1.02]';
mesh(X,Y,F)
hidden off
hold on
plot3(x,y,b,'*','MarkerSize',10)
that what i have, told me where's yours mdification
Invalid code. You do not define X and Y until after you already used them to create F. Also you plot3() of b with no "b" defined
Assuming you correct that order, then remove the final plot3() and add
F1 = a(1)+a(2)*x+a(3)*y+a(4)*x.^2+a(5)*x.*y+a(6)*y.^2;
for K = 1 : length(x)
plot3([x(K), x(K)], [y(K), y(K)], [F1(K), z(K)], 'r');
plot3(x(K), y(K), z(K), 'r*', 'MarkerSize', 10);
end
Correct working code is given in this comment of his duplicate post - however the link doesn't point directly to the comment because of the bug in Answers where links to hidden/older comments don't display and instead display the main page. So you have to expand the older comments to see it. I really wish they'd fix that bug in Answers! (I notified Randy already.)

Sign in to comment.

Tags

Asked:

on 5 Jan 2013

Community Treasure Hunt

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

Start Hunting!