您的位置:首页 > 编程语言 > MATLAB

matlab 画network,papa的儿子

2015-08-07 20:52 363 查看


clear all
clc
clf

%%
n=18;
theta = linspace(0,2*pi,(n+1));
theta = theta(1:end-1);
[x,y] = pol2cart(theta,1);

links=triu(round(rand(length(theta))));%# this is a random list of connections
[ind1,ind2] = ind2sub(size(links),find(links(:)));

txt = cellstr(num2str((1:n)','%02d'));

% p_tm=symrcm(links);
% links_new=links(p_tm,p_tm);
% txt = txt(p_tm);

weig =rand(size(ind1));

col_mm = jet(length(ind1));

plot(x,y,'.k','markersize',20);
hold on
axis equal

arrayfun(@(p,q,r,colr,colg,colb)line([x(p),x(q)],[y(p),y(q)],...
'linewidth',1+2*r,'color',[colr colg colb]),ind1,ind2,weig...
,col_mm(:,1),col_mm(:,2),col_mm(:,3));
axis equal off

h = text(x.*1.1, y.*1.1, txt, 'FontSize',14);

for i=1:n
set(h(i), 'Rotation',theta(i)*180/pi-90);
end

colorbar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: