How to plot as lines instead of dots

3 ビュー (過去 30 日間)
shdotcom shdotcom
shdotcom shdotcom 2019 年 6 月 3 日
コメント済み: shdotcom shdotcom 2019 年 6 月 6 日
Is it possible to plot this:
n= 3;
f = UniformPoint(1000,n);
f = f./repmat(sqrt(sum(f.^2,2)),1,n);
PFcolor = [0.2 0.2 0.2];
varargin = {'Ok','MarkerSize',1.5 , 'Marker','^','MarkerFaceColor',PFcolor, 'MarkerEdgeColor', PFcolor};
plot3(f(:,1),f(:,2),f(:,3),varargin{:});
set(gca,'NextPlot','add','Box','on','Fontname','Times New Roman','FontSize',16);
set(gca,'XTickMode','auto','YTickMode','auto','ZTickMode','auto','View',[135 30]);
grid on
box on
function [W,N] = UniformPoint(N,M)
H1 = 1;
while nchoosek(H1+M,M-1) <= N
H1 = H1 + 1;
end
W = nchoosek(1:H1+M-1,M-1) - repmat(0:M-2,nchoosek(H1+M-1,M-1),1) - 1;
W = ([W,zeros(size(W,1),1)+H1]-[zeros(size(W,1),1),W])/H1;
if H1 < M
H2 = 0;
while nchoosek(H1+M-1,M-1)+nchoosek(H2+M,M-1) <= N
H2 = H2 + 1;
end
if H2 > 0
W2 = nchoosek(1:H2+M-1,M-1) - repmat(0:M-2,nchoosek(H2+M-1,M-1),1) - 1;
W2 = ([W2,zeros(size(W2,1),1)+H2]-[zeros(size(W2,1),1),W2])/H2;
W = [W;W2/2+1/(2*M)];
end
end
W = max(W,1e-6);
N = size(W,1);
end
to be like this (without black dots and red star):

回答 (1 件)

Luuk van Oosten
Luuk van Oosten 2019 年 6 月 4 日
Dear shdotcom,
Looks like you could use surf and mesh for that job. If you need it to plot it exactly as your example, keep in mind that your data ifrom the mesh function are the intersections of the wireframe grid lines.
Have fun!
  1 件のコメント
shdotcom shdotcom
shdotcom shdotcom 2019 年 6 月 6 日
Dear Luuk van Oosten, thank you for your answer. If I want to use mesh or surf, may I know what are X, Y and Z in my case? The data is generated using the code in the question.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by