How to use plot3 with Pointwise Coordinates

1 回表示 (過去 30 日間)
Sven
Sven 2015 年 7 月 17 日
編集済み: Sven 2015 年 7 月 17 日
Hi,
I want to plot data that is stored in arrays containing their coordinates with plot3, as Point1 containing [x1,y1,z1] and draw lines between them. But I do not want to pass them one coordinate each. My favorite notation would be something like:
point1 = [1 1 1];
point2 = [2 2 2];
plot3(point1,'marker','.','MarkerSize',25);
plot3(point2,'marker','.','MarkerSize',25);
plot3(point1, point2, 'LineStyle', ':', 'LineWidth', 2);
Limited by my current knowledge I would write the plot lines as:
plot3(point1(1),point1(2),point1(3),'marker','.','MarkerSize',25);
plot3(point2(1),point2(2),point2(3),'marker','.','MarkerSize',25);
plot3([point1(1),point2(1)],[point1(2),point2(2)],[point1(3),point2(3)], 'LineStyle', ':', 'LineWidth', 2);
But this appears overly cumbersome to me. Is there any command or trick I missed. Can I pass an array with point coordinates to plot3 or is there a way to pass the array elementwise with an elegant trick.
P.S.: I have named the points as point1 and point2 for clarity usually I would store them in an array of points.

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by