how i can connect equal point to gather of 2 separated graph on same figure

Answers (1)

Not sure what "connect" means to you, but how about using the line() function?

11 Comments

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)
above code generate mesh plot and data on same figure i want to connect data with mesh surface, is it clear ???
This code doesn't run, even after fixing about 10 things. Please paste code that I can simply copy, paste, and run.
a=[8.5319; 5.8468; 1.9691; 1.3863; -2.5172; 2.7046]
x1=-1:.01:1;
y1=-2:.01:2;
[X,Y]=meshgrid(x1,y1);
F=a(1)+a(2)*X+a(3)*Y+a(4)*X.^2+a(5)*X.*Y+a(6)*Y.^2;
%data points
b=[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)
Yes, it runs now, though you can just paste your code in, highlight it, and click {}Code icon. You don't need to double space the lines if you do that.
But I still don't know what "connect equal data point to gather of 2 separated graph" means. I thought there was going to be 2 graphs, not 1. And I still don't know what connect means. Would line() work? And do you mean "gather" (it means to collect into a group), or does "to gather" really mean together (like joined or linked to each other)? And how do you define "equal"?
my code generate mesh surface and data point ('*') in same figure i need to connect data point with its equal in mesh surface to appear like stems connect data point('*') with surface
OK. Like I said, line() should do it. For each x,y coordinate, you call
line([xMesh, xData], [yMesh, yData], [zMesh, zData]);

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 5 Jan 2013

Community Treasure Hunt

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

Start Hunting!