function movie1(filename,p,w)

aviobj = avifile(filename,'fps',5);

for k=0:300
    z = psf(p,(k/100)*w);
    out = logim(z,3);
    imshow(out);
    rgb = cat(3,out,out,out);
    frame = im2frame(rgb);
    aviobj = addframe(aviobj,frame);
end

aviobj = close(aviobj);