How to connect points horizontally and vertically in non-rect grid?

4 ビュー (過去 30 日間)
Chris
Chris 2013 年 9 月 20 日
Hey,
I've been working on a problem and have gotten stuck. I've been trying to make a grid of points of a customized shape. I've got the X and Y points of the grid, but I don't know how to completely connect them in 2 directions.
Here is what I have:
Notice how the lines connect in one direction. I want it such that lines go through the "O's" as well. How do I pull this off?
General code:
-giant X matrix with X coordinate of each point. -giant Y matrix of Y coordinate of each point.
figure plot(X,Y,'-o')
Thanks for any help / advice you can give.

採用された回答

Teja Muppirala
Teja Muppirala 2013 年 9 月 20 日
Idea 1. Use SURF
[x,y] = ndgrid(0:0.1:2); %Just making random data
x = sin(x).*y;
y = x+y.^2;
figure, surf(x,y,zeros(size(x)),'facecolor','none','marker','o','edgecolor','k');
view(2);
Idea 2. Use PLOT twice, the second time with the matrices transposed.
[x,y] = ndgrid(0:0.1:2);
x = sin(x).*y;
y = x+y.^2;
figure, plot(x,y,'o-')
hold on;
plot(x',y','o-')

その他の回答 (1 件)

Chris
Chris 2013 年 9 月 20 日
Oh wow. The transpose worked perfectly:
Thanks.

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by