I would like to create an animation to demonstrate LDPC coding which is based on Sum-Product Algorithm
So far I have created a graph which shows the connections between symbol nodes (left) and parity nodes (right)alt text http://img29.imageshack.us/img29/9780/ldpc.jpg and would like to animate points travelling from symbol to parity nodes and back.
The figure is drawn by executing the following method:
function drawVertices(H)
hold on;
nodesCount = size(H);
parityNodesCount = nodesCount(1);
symbolNodesCount = nodesCount(2);
symbolPoints = zeros(symbolNodesCount, 2);
symbolPoints(:, 1) = 0;
for i = 0 : symbolNodesCount - 1
ji = symbolNodesCount - i;
scatter(0, ji)
symbolPoints(i + 1, 2) = ji;
end;
parityPoints = zeros(parityNodesCount, 2);
parityPoints(:, 1) = 10;
for i = 0 : parityNodesCount - 1
ji = parityNodesCount - i;
y0 = symbolNodesCount/2 - parityNodesCount/2;
scatter(10, y0 + ji)
parityPoints(i + 1, 2) = y0 + ji;
end;
axis([-1 11 -1 symbolNodesCount + 2]);
axis off
%connect vertices
d = size(H);
for i = 1 : d(1)
for j = 1 : d(2)
if(H(i, j) == 1)
plot([parityPoints(i, 1) symbolPoints(j, 1)], [parityPoints(i, 2) symbolPoints(j, 2)]);
end;
end;
end;
So what I would like to do here is to add another method which takes start point (x and y) and end point as arguments and animates a travelling circle (dot) from start to end and back along the displayed lines.
I would appreciate if anyone of you could show the solution or suggest any useful tutorial about matlab simulations.
Thank you!
I believe the best way to learn is by example. So I suggest you look at the demo
lorenz
which comes with MATLAB:For other cool animations, look for
orbits.m
andswinger.m
demos part of Cleve Moler's book: Experiments with MATLABI show here a simple animation of a point moving along a circular path. The hold idea boils down to using
EraseMode
set toxor
, and updatingXData
andYData
of the point for each iteration:For a detailed explanation of the parameters used (
EraseMode
,Backingstore
,DoubleBuffer
, ..), refer to this animation guideFrom the documentation for comet.m