How to plot two matrices of different sizes in the same figure?

조회 수: 2 (최근 30일)
Angelo Giuseppe Spinosa
Angelo Giuseppe Spinosa 2017년 3월 30일
편집: Joseph Cheng 2017년 3월 30일
Good morning to everybody. I have a file containing some information about the connectivity scheme of a neural network; each entry is something like to (pre,post,weight), where pre refers to the index of the pre-synaptic neuron, post refers to the index of the post-synaptic neuron and weight is the value of the synaptic weight assigned to that specific link. Pre- and postsynaptic populations are separate and I would like to plot the former as a column vector and the latter as a matrix (more specifically: I have just three neurons belonging to the pre-synaptic population, while the post-synaptic one comprises 64 neurons arranged as an 8x8 matrix), both by using imagesc, in order to obtain something like this:
In particular, each pre-synaptic neuron could be connected to a post-synaptic neuron with a synapse whose weight is greater than 0 (red line), otherwise the line should be colored differently (for example, in blue) or, at least, could be completely removed.
How can I solve the problem?
  댓글 수: 2
Jan
Jan 2017년 3월 30일
The image is missing, therefore we cannot guess where the "red line" is.
Angelo Giuseppe Spinosa
Angelo Giuseppe Spinosa 2017년 3월 30일
편집: Angelo Giuseppe Spinosa 2017년 3월 30일
I'm sorry, I fixed it.

댓글을 달려면 로그인하십시오.

답변 (1개)

Joseph Cheng
Joseph Cheng 2017년 3월 30일
편집: Joseph Cheng 2017년 3월 30일
I would go with something like this
%%gen 8x8 post grid
figure(1),clf, surf([1:8],[1:8],zeros(8,8)),view([0 90]), hold on
%%gen 3x1 pre grid
surf([-2:-1],[3:6],-ones(4,2)),view([0 90]), hold on
%%gen dummy connections
%half into boxes are 0.5
prepoints = [repmat(-1.5,10,1) 3.5+randi(2,10,1)];
postpoints = [1.5+randi(6,10,1) 1.5+randi(6,10,1)];
%for the blue
for ind = 1:5
quiver(prepoints(ind,1),prepoints(ind,2),...
[postpoints(ind,1)-prepoints(ind,1)],[postpoints(ind,2)-prepoints(ind,2)],'b')
end
%for the orange
for ind = 6:10
quiver(prepoints(ind,1),prepoints(ind,2),...
[postpoints(ind,1)-prepoints(ind,1)],[postpoints(ind,2)-prepoints(ind,2)],'r')
end
don't have the time to try to remember why i cannot do all the quiver points all together. Looks like it scales them by how many quivers are being plotted.
but the above is to generate the grids and then link the two based off of what you know goes where. all that is left is to add text and get rid of the axes/grids.
oh and pardon my randi statement. randi doesn't include 0 but they are dummy points anyways

카테고리

Help CenterFile Exchange에서 Stateflow Charts에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by