pkg load video

freq = 10; %hz;    
freq = 11.8654434250765
freq = 14,1284403669725
freq = 16,8195718654434

fname = [ "video" num2str(freq) "_half_Hz.avi"]

avi = avifile (fname, "fps", 60);

image = zeros(640, 480, 3);
   
Period = 1/freq; % 0.01 for 10 Hz

for t=0:1/60:30
        
    n = t/(2*Period);
    dn = n - floor(n);
    if dn<0.5
        image = zeros(640, 480, 3);
    else
        image = ones(640, 480, 3);
    end

    addframe (avi, image)
    
    
end
    