Thursday, April 25, 2024
HomeMatlabA Brief Sport of Life » Steve on Picture Processing with MATLAB

A Brief Sport of Life » Steve on Picture Processing with MATLAB


Not too long ago, I noticed a very concise implementation of the sport. My MathWorks colleague, Christopher Creutzig, lately posted the next code snippet on a MathWorks firm discussion board. These seven strains of code initialize a 750×750 sport board, run the board by means of 500 generations, and save the outcome as an animated GIF file.

im = rand(750,750)>0.8;

for okay=1:500

t = conv2(im(:,:,okay),[2,2,2;2,1,2;2,2,2],‘similar’);

im(:,:,1,okay+1) = (t > 4) & (t < 8);

finish

imwrite(~im,‘life.gif’,‘DelayTime’,0,‘LoopCount’,1)

Matt McDonnell, a former MathWorks advisor, explored a number of brief implementation methods in his 19-Jan-2010 submit on Loren’s Artwork of MATLAB. Extra good concepts might be discovered within the reader feedback on that submit.

Get pleasure from!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments