Matlab Simulation: Point (symbol) Moving from start point to end point and back

Posted by niko on Stack Overflow See other posts from Stack Overflow or by niko
Published on 2010-05-08T13:01:59Z Indexed on 2010/05/08 13:08 UTC
Read the original article Hit count: 303

Filed under:
|

Hi,

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 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!

© Stack Overflow or respective owner

Related posts about matlab

Related posts about animation